Skip to content

Commit

Permalink
Merge pull request ome#6204 from will-moore/web_test_DJANGO_SETTINGS_…
Browse files Browse the repository at this point in the history
…MODULE

Fix DJANGO_SETTINGS_MODULE not defined
  • Loading branch information
joshmoore authored Jan 24, 2020
2 parents aebc40a + 11f81d5 commit c26ace4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
13 changes: 9 additions & 4 deletions components/tools/OmeroPy/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,15 @@ def pytest_configure(config):
os.environ["OMERO_USERDIR"] = workdir(workerid)


def pytest_configure_node(node):
if hasattr(node, 'slaveinput'):
workerid = node.slaveinput["workerid"]
os.environ["OMERO_USERDIR"] = workdir(workerid)
try:
import xdist # noqa

def pytest_configure_node(node):
if hasattr(node, 'slaveinput'):
workerid = node.slaveinput["workerid"]
os.environ["OMERO_USERDIR"] = workdir(workerid)
except ImportError:
pass


pytest_plugins = "omero.gateway.pytest_fixtures"
9 changes: 1 addition & 8 deletions components/tools/OmeroWeb/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@
from setuptools import setup
from omero_version import omero_version as ov

if "test" in sys.argv:
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "omeroweb.settings")

import django
if django.VERSION > (1, 7):
django.setup()


setup(name="OmeroWeb",
version=ov,
Expand All @@ -33,5 +26,5 @@
download_url="https://github.com/openmicroscopy/openmicroscopy/",
packages=[''],
test_suite='test.suite',
tests_require=['pytest', 'pytest-xdist'],
tests_require=['pytest', 'pytest-xdist', 'pytest-django'],
)
13 changes: 9 additions & 4 deletions components/tools/OmeroWeb/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ def pytest_configure(config):
os.environ["OMERO_USERDIR"] = workdir(workerid)


def pytest_configure_node(node):
if hasattr(node, 'slaveinput'):
workerid = node.slaveinput["workerid"]
os.environ["OMERO_USERDIR"] = workdir(workerid)
try:
import xdist # noqa

def pytest_configure_node(node):
if hasattr(node, 'slaveinput'):
workerid = node.slaveinput["workerid"]
os.environ["OMERO_USERDIR"] = workdir(workerid)
except ImportError:
pass
2 changes: 2 additions & 0 deletions components/tools/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[pytest]
# pip install pytest-django
DJANGO_SETTINGS_MODULE = omeroweb.settings
markers =
broken: mark the test as broken, i.e. it may be intermittent or failing without a fully understood cause
fs_suite: group together FS tests

0 comments on commit c26ace4

Please sign in to comment.