Skip to content

Not all tests pass after cloning and running make test #483

Closed
@gradam

Description

@gradam

When I clone the repo and run make test 3 of them fails.

Output:

$ make test
virtualenv .
Using base prefix '/usr'
New python executable in /home/kuba/temp/t2/pytest-django/bin/python3
Also creating executable in /home/kuba/temp/t2/pytest-django/bin/python
Installing setuptools, pip, wheel...done.
bin/pip install -Ur requirements.txt
Obtaining file:///home/kuba/temp/t2/pytest-django (from -r requirements.txt (line 1))
Requirement already up-to-date: setuptools in ./lib/python3.5/site-packages (from -r requirements.txt (line 2))
Collecting django (from -r requirements.txt (line 3))
  Using cached Django-1.11.1-py2.py3-none-any.whl
Collecting django-configurations (from -r requirements.txt (line 4))
  Using cached django_configurations-2.0-py2.py3-none-any.whl
Collecting pytest-xdist (from -r requirements.txt (line 5))
Collecting tox (from -r requirements.txt (line 6))
  Using cached tox-2.7.0-py2.py3-none-any.whl
Requirement already up-to-date: wheel in ./lib/python3.5/site-packages (from -r requirements.txt (line 7))
Collecting twine (from -r requirements.txt (line 8))
  Using cached twine-1.9.1-py2.py3-none-any.whl
Collecting flake8 (from -r requirements.txt (line 9))
  Using cached flake8-3.3.0-py2.py3-none-any.whl
Collecting Flask-Sphinx-Themes (from -r requirements.txt (line 10))
  Using cached Flask_Sphinx_Themes-1.0.1-py2.py3-none-any.whl
Collecting pytest>=2.9 (from pytest-django==3.1.3.dev25+gaf04673->-r requirements.txt (line 1))
  Using cached pytest-3.1.0-py2.py3-none-any.whl
Requirement already up-to-date: packaging>=16.8 in ./lib/python3.5/site-packages (from setuptools->-r requirements.txt (line 2))
Requirement already up-to-date: six>=1.6.0 in ./lib/python3.5/site-packages (from setuptools->-r requirements.txt (line 2))
Requirement already up-to-date: appdirs>=1.4.0 in ./lib/python3.5/site-packages (from setuptools->-r requirements.txt (line 2))
Collecting pytz (from django->-r requirements.txt (line 3))
  Using cached pytz-2017.2-py2.py3-none-any.whl
Collecting execnet>=1.1 (from pytest-xdist->-r requirements.txt (line 5))
  Using cached execnet-1.4.1-py2.py3-none-any.whl
Collecting py>=1.4.22 (from pytest-xdist->-r requirements.txt (line 5))
  Using cached py-1.4.33-py2.py3-none-any.whl
Collecting pluggy<1.0,>=0.3.0 (from tox->-r requirements.txt (line 6))
  Using cached pluggy-0.4.0-py2.py3-none-any.whl
Collecting virtualenv>=1.11.2; python_version != "3.2" (from tox->-r requirements.txt (line 6))
  Using cached virtualenv-15.1.0-py2.py3-none-any.whl
Collecting pkginfo>=1.0 (from twine->-r requirements.txt (line 8))
  Using cached pkginfo-1.4.1-py2.py3-none-any.whl
Collecting requests-toolbelt>=0.8.0 (from twine->-r requirements.txt (line 8))
  Using cached requests_toolbelt-0.8.0-py2.py3-none-any.whl
Collecting requests!=2.15,!=2.16,>=2.5.0 (from twine->-r requirements.txt (line 8))
  Using cached requests-2.16.5-py2.py3-none-any.whl
Collecting tqdm>=4.11 (from twine->-r requirements.txt (line 8))
  Using cached tqdm-4.11.2-py2.py3-none-any.whl
Collecting pyflakes<1.6.0,>=1.5.0 (from flake8->-r requirements.txt (line 9))
  Using cached pyflakes-1.5.0-py2.py3-none-any.whl
Collecting pycodestyle<2.4.0,>=2.0.0 (from flake8->-r requirements.txt (line 9))
  Using cached pycodestyle-2.3.1-py2.py3-none-any.whl
Collecting mccabe<0.7.0,>=0.6.0 (from flake8->-r requirements.txt (line 9))
  Using cached mccabe-0.6.1-py2.py3-none-any.whl
Collecting Sphinx (from Flask-Sphinx-Themes->-r requirements.txt (line 10))
  Using cached Sphinx-1.6.1-py2.py3-none-any.whl
Requirement already up-to-date: pyparsing in ./lib/python3.5/site-packages (from packaging>=16.8->setuptools->-r requirements.txt (line 2))
Collecting apipkg>=1.4 (from execnet>=1.1->pytest-xdist->-r requirements.txt (line 5))
  Using cached apipkg-1.4-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests!=2.15,!=2.16,>=2.5.0->twine->-r requirements.txt (line 8))
  Using cached chardet-3.0.3-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests!=2.15,!=2.16,>=2.5.0->twine->-r requirements.txt (line 8))
  Using cached certifi-2017.4.17-py2.py3-none-any.whl
Collecting urllib3<1.22,>=1.21.1 (from requests!=2.15,!=2.16,>=2.5.0->twine->-r requirements.txt (line 8))
  Using cached urllib3-1.21.1-py2.py3-none-any.whl
Collecting idna<2.6,>=2.5 (from requests!=2.15,!=2.16,>=2.5.0->twine->-r requirements.txt (line 8))
  Using cached idna-2.5-py2.py3-none-any.whl
Collecting sphinxcontrib-websupport (from Sphinx->Flask-Sphinx-Themes->-r requirements.txt (line 10))
  Using cached sphinxcontrib_websupport-1.0.1-py2.py3-none-any.whl
Collecting Pygments>=2.0 (from Sphinx->Flask-Sphinx-Themes->-r requirements.txt (line 10))
  Using cached Pygments-2.2.0-py2.py3-none-any.whl
Collecting babel!=2.0,>=1.3 (from Sphinx->Flask-Sphinx-Themes->-r requirements.txt (line 10))
  Using cached Babel-2.4.0-py2.py3-none-any.whl
Collecting alabaster<0.8,>=0.7 (from Sphinx->Flask-Sphinx-Themes->-r requirements.txt (line 10))
  Using cached alabaster-0.7.10-py2.py3-none-any.whl
Collecting imagesize (from Sphinx->Flask-Sphinx-Themes->-r requirements.txt (line 10))
  Using cached imagesize-0.7.1-py2.py3-none-any.whl
Collecting Jinja2>=2.3 (from Sphinx->Flask-Sphinx-Themes->-r requirements.txt (line 10))
  Using cached Jinja2-2.9.6-py2.py3-none-any.whl
Collecting snowballstemmer>=1.1 (from Sphinx->Flask-Sphinx-Themes->-r requirements.txt (line 10))
  Using cached snowballstemmer-1.2.1-py2.py3-none-any.whl
Collecting typing (from Sphinx->Flask-Sphinx-Themes->-r requirements.txt (line 10))
Collecting docutils>=0.11 (from Sphinx->Flask-Sphinx-Themes->-r requirements.txt (line 10))
  Using cached docutils-0.13.1-py3-none-any.whl
Collecting MarkupSafe>=0.23 (from Jinja2>=2.3->Sphinx->Flask-Sphinx-Themes->-r requirements.txt (line 10))
Installing collected packages: pytz, django, django-configurations, apipkg, execnet, py, pytest, pytest-xdist, pluggy, virtualenv, tox, pkginfo, chardet, certifi, urllib3, idna, requests, requests-toolbelt, tqdm, twine, pyflakes, pycodestyle, mccabe, flake8, sphinxcontrib-websupport, Pygments, babel, alabaster, imagesize, MarkupSafe, Jinja2, snowballstemmer, typing, docutils, Sphinx, Flask-Sphinx-Themes, pytest-django
  Running setup.py develop for pytest-django
Successfully installed Flask-Sphinx-Themes-1.0.1 Jinja2-2.9.6 MarkupSafe-1.0 Pygments-2.2.0 Sphinx-1.6.1 alabaster-0.7.10 apipkg-1.4 babel-2.4.0 certifi-2017.4.17 chardet-3.0.3 django-1.11.1 django-configurations-2.0 docutils-0.13.1 execnet-1.4.1 flake8-3.3.0 idna-2.5 imagesize-0.7.1 mccabe-0.6.1 pkginfo-1.4.1 pluggy-0.4.0 py-1.4.33 pycodestyle-2.3.1 pyflakes-1.5.0 pytest-3.1.0 pytest-django pytest-xdist-1.16.0 pytz-2017.2 requests-2.16.5 requests-toolbelt-0.8.0 snowballstemmer-1.2.1 sphinxcontrib-websupport-1.0.1 tox-2.7.0 tqdm-4.11.2 twine-1.9.1 typing-3.6.1 urllib3-1.21.1 virtualenv-15.1.0
touch bin/py.test
bin/pip install -e .
Obtaining file:///home/kuba/temp/t2/pytest-django
Requirement already satisfied: pytest>=2.9 in ./lib/python3.5/site-packages (from pytest-django==3.1.3.dev25+gaf04673)
Requirement already satisfied: py>=1.4.29 in ./lib/python3.5/site-packages (from pytest>=2.9->pytest-django==3.1.3.dev25+gaf04673)
Requirement already satisfied: setuptools in ./lib/python3.5/site-packages (from pytest>=2.9->pytest-django==3.1.3.dev25+gaf04673)
Requirement already satisfied: appdirs>=1.4.0 in ./lib/python3.5/site-packages (from setuptools->pytest>=2.9->pytest-django==3.1.3.dev25+gaf04673)
Requirement already satisfied: six>=1.6.0 in ./lib/python3.5/site-packages (from setuptools->pytest>=2.9->pytest-django==3.1.3.dev25+gaf04673)
Requirement already satisfied: packaging>=16.8 in ./lib/python3.5/site-packages (from setuptools->pytest>=2.9->pytest-django==3.1.3.dev25+gaf04673)
Requirement already satisfied: pyparsing in ./lib/python3.5/site-packages (from packaging>=16.8->setuptools->pytest>=2.9->pytest-django==3.1.3.dev25+gaf04673)
Installing collected packages: pytest-django
  Found existing installation: pytest-django 3.1.3.dev25+gaf04673
    Uninstalling pytest-django-3.1.3.dev25+gaf04673:
      Successfully uninstalled pytest-django-3.1.3.dev25+gaf04673
  Running setup.py develop for pytest-django
Successfully installed pytest-django
bin/py.test
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.5.2+, pytest-3.1.0, py-1.4.33, pluggy-0.4.0
Django settings: pytest_django_test.settings_sqlite_file (from environment variable)
rootdir: /home/kuba/temp/t2/pytest-django, inifile: setup.cfg
plugins: xdist-1.16.0, django-3.1.3.dev25+gaf04673
collected 134 items 

tests/test_database.py ..........................
tests/test_db_setup.py .....s..
tests/test_django_configurations.py FFF
tests/test_django_settings_module.py ..............
tests/test_doctest.txt .
tests/test_environment.py ...................
tests/test_fixtures.py ....................................
tests/test_manage_py_scan.py ....
tests/test_unittest.py .............
tests/test_urls.py ...
tests/test_without_django_loaded.py .......
============================================================================================= short test summary info =============================================================================================
FAIL tests/test_django_configurations.py::test_dc_env
FAIL tests/test_django_configurations.py::test_dc_ini
FAIL tests/test_django_configurations.py::test_dc_option
SKIP [1] tests/test_db_setup.py:203: Django 1.9 requires migration and has no concept of initial data fixtures

==================================================================================================== FAILURES =====================================================================================================
___________________________________________________________________________________________________ test_dc_env ___________________________________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-kuba/pytest-1/testdir/test_dc_env0')>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f8338940978>

    def test_dc_env(testdir, monkeypatch):
        monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'tpkg.settings_env')
        monkeypatch.setenv('DJANGO_CONFIGURATION', 'MySettings')
    
        pkg = testdir.mkpydir('tpkg')
        settings = pkg.join('settings_env.py')
        settings.write(BARE_SETTINGS)
        testdir.makepyfile("""
            import os
    
            def test_settings():
                assert os.environ['DJANGO_SETTINGS_MODULE'] == 'tpkg.settings_env'
                assert os.environ['DJANGO_CONFIGURATION'] == 'MySettings'
        """)
        result = testdir.runpytest_subprocess()
>       result.stdout.fnmatch_lines(['*1 passed*'])
E       Failed: remains unmatched: '*1 passed*'

/home/kuba/temp/t2/pytest-django/tests/test_django_configurations.py:48: Failed
---------------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------------
running: /home/kuba/temp/t2/pytest-django/bin/python3 /home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/pytest.py --basetemp=/tmp/pytest-of-kuba/pytest-1/testdir/test_dc_env0/runpytest-0
     in: /tmp/pytest-of-kuba/pytest-1/testdir/test_dc_env0
---------------------------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/kuba/temp/t2/pytest-django/pytest_django/plugin.py", line 114, in _handle_import_error
    yield
  File "/home/kuba/temp/t2/pytest-django/pytest_django/plugin.py", line 245, in pytest_load_initial_conftests
    dj_settings.DATABASES
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/conf/__init__.py", line 41, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/conf/__init__.py", line 110, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/configurations/importer.py", line 146, in load_module
    mod = imp.load_module(fullname, *self.location)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/tmp/pytest-of-kuba/pytest-1/testdir/test_dc_env0/tpkg/settings_env.py", line 2, in <module>
    from configurations import Settings
ImportError: cannot import name 'Settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/pytest.py", line 73, in <module>
    raise SystemExit(pytest.main())
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 49, in main
    config = _prepareconfig(args, plugins)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 158, in _prepareconfig
    pluginmanager=pluginmanager, args=args)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 250, in _wrapped_call
    wrap_controller.send(call_outcome)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/helpconfig.py", line 34, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
    self.result = func()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 928, in pytest_cmdline_parse
    self.parse(args)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 1086, in parse
    self._preparse(args, addopts=addopts)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 1057, in _preparse
    args=args, parser=self._parser)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 254, in _wrapped_call
    return call_outcome.get_result()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
    self.result = func()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "/home/kuba/temp/t2/pytest-django/pytest_django/plugin.py", line 245, in pytest_load_initial_conftests
    dj_settings.DATABASES
  File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/kuba/temp/t2/pytest-django/pytest_django/plugin.py", line 118, in _handle_import_error
    raise ImportError(msg)
ImportError: cannot import name 'Settings'

pytest-django could not find a Django project (no manage.py file could be found). You must explicitly add your Django project to the Python path to have it picked up.
___________________________________________________________________________________________________ test_dc_ini ___________________________________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-kuba/pytest-1/testdir/test_dc_ini0')>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f8338854358>

    def test_dc_ini(testdir, monkeypatch):
        monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'tpkg.settings_env')
        monkeypatch.setenv('DJANGO_CONFIGURATION', 'MySettings')
    
        testdir.makeini("""
           [pytest]
           DJANGO_SETTINGS_MODULE = DO_NOT_USE_ini
           DJANGO_CONFIGURATION = DO_NOT_USE_ini
        """)
        pkg = testdir.mkpydir('tpkg')
        settings = pkg.join('settings_env.py')
        settings.write(BARE_SETTINGS)
        testdir.makepyfile("""
            import os
    
            def test_ds():
                assert os.environ['DJANGO_SETTINGS_MODULE'] == 'tpkg.settings_env'
                assert os.environ['DJANGO_CONFIGURATION'] == 'MySettings'
        """)
        result = testdir.runpytest_subprocess()
>       result.stdout.fnmatch_lines(['*1 passed*'])
E       Failed: remains unmatched: '*1 passed*'

/home/kuba/temp/t2/pytest-django/tests/test_django_configurations.py:72: Failed
---------------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------------
running: /home/kuba/temp/t2/pytest-django/bin/python3 /home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/pytest.py --basetemp=/tmp/pytest-of-kuba/pytest-1/testdir/test_dc_ini0/runpytest-0
     in: /tmp/pytest-of-kuba/pytest-1/testdir/test_dc_ini0
---------------------------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/kuba/temp/t2/pytest-django/pytest_django/plugin.py", line 114, in _handle_import_error
    yield
  File "/home/kuba/temp/t2/pytest-django/pytest_django/plugin.py", line 245, in pytest_load_initial_conftests
    dj_settings.DATABASES
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/conf/__init__.py", line 41, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/conf/__init__.py", line 110, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/configurations/importer.py", line 146, in load_module
    mod = imp.load_module(fullname, *self.location)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/tmp/pytest-of-kuba/pytest-1/testdir/test_dc_ini0/tpkg/settings_env.py", line 2, in <module>
    from configurations import Settings
ImportError: cannot import name 'Settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/pytest.py", line 73, in <module>
    raise SystemExit(pytest.main())
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 49, in main
    config = _prepareconfig(args, plugins)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 158, in _prepareconfig
    pluginmanager=pluginmanager, args=args)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 250, in _wrapped_call
    wrap_controller.send(call_outcome)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/helpconfig.py", line 34, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
    self.result = func()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 928, in pytest_cmdline_parse
    self.parse(args)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 1086, in parse
    self._preparse(args, addopts=addopts)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 1057, in _preparse
    args=args, parser=self._parser)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 254, in _wrapped_call
    return call_outcome.get_result()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
    self.result = func()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "/home/kuba/temp/t2/pytest-django/pytest_django/plugin.py", line 245, in pytest_load_initial_conftests
    dj_settings.DATABASES
  File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/kuba/temp/t2/pytest-django/pytest_django/plugin.py", line 118, in _handle_import_error
    raise ImportError(msg)
ImportError: cannot import name 'Settings'

pytest-django could not find a Django project (no manage.py file could be found). You must explicitly add your Django project to the Python path to have it picked up.
_________________________________________________________________________________________________ test_dc_option __________________________________________________________________________________________________

testdir = <Testdir local('/tmp/pytest-of-kuba/pytest-1/testdir/test_dc_option0')>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f8338854940>

    def test_dc_option(testdir, monkeypatch):
        monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'DO_NOT_USE_env')
        monkeypatch.setenv('DJANGO_CONFIGURATION', 'DO_NOT_USE_env')
    
        testdir.makeini("""
           [pytest]
           DJANGO_SETTINGS_MODULE = DO_NOT_USE_ini
           DJANGO_CONFIGURATION = DO_NOT_USE_ini
        """)
        pkg = testdir.mkpydir('tpkg')
        settings = pkg.join('settings_opt.py')
        settings.write(BARE_SETTINGS)
        testdir.makepyfile("""
            import os
    
            def test_ds():
                assert os.environ['DJANGO_SETTINGS_MODULE'] == 'tpkg.settings_opt'
                assert os.environ['DJANGO_CONFIGURATION'] == 'MySettings'
        """)
        result = testdir.runpytest_subprocess('--ds=tpkg.settings_opt', '--dc=MySettings')
>       result.stdout.fnmatch_lines(['*1 passed*'])
E       Failed: remains unmatched: '*1 passed*'

/home/kuba/temp/t2/pytest-django/tests/test_django_configurations.py:96: Failed
---------------------------------------------------------------------------------------------- Captured stdout call -----------------------------------------------------------------------------------------------
running: /home/kuba/temp/t2/pytest-django/bin/python3 /home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/pytest.py --basetemp=/tmp/pytest-of-kuba/pytest-1/testdir/test_dc_option0/runpytest-0 --ds=tpkg.settings_opt --dc=MySettings
     in: /tmp/pytest-of-kuba/pytest-1/testdir/test_dc_option0
---------------------------------------------------------------------------------------------- Captured stderr call -----------------------------------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/kuba/temp/t2/pytest-django/pytest_django/plugin.py", line 114, in _handle_import_error
    yield
  File "/home/kuba/temp/t2/pytest-django/pytest_django/plugin.py", line 245, in pytest_load_initial_conftests
    dj_settings.DATABASES
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/conf/__init__.py", line 56, in __getattr__
    self._setup(name)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/conf/__init__.py", line 41, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/conf/__init__.py", line 110, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/configurations/importer.py", line 146, in load_module
    mod = imp.load_module(fullname, *self.location)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 693, in _load
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 673, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/tmp/pytest-of-kuba/pytest-1/testdir/test_dc_option0/tpkg/settings_opt.py", line 2, in <module>
    from configurations import Settings
ImportError: cannot import name 'Settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/pytest.py", line 73, in <module>
    raise SystemExit(pytest.main())
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 49, in main
    config = _prepareconfig(args, plugins)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 158, in _prepareconfig
    pluginmanager=pluginmanager, args=args)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 250, in _wrapped_call
    wrap_controller.send(call_outcome)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/helpconfig.py", line 34, in pytest_cmdline_parse
    config = outcome.get_result()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
    self.result = func()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 928, in pytest_cmdline_parse
    self.parse(args)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 1086, in parse
    self._preparse(args, addopts=addopts)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/config.py", line 1057, in _preparse
    args=args, parser=self._parser)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
    _MultiCall(methods, kwargs, hook.spec_opts).execute()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 613, in execute
    return _wrapped_call(hook_impl.function(*args), self.execute)
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 254, in _wrapped_call
    return call_outcome.get_result()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 279, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 265, in __init__
    self.result = func()
  File "/home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
    res = hook_impl.function(*args)
  File "/home/kuba/temp/t2/pytest-django/pytest_django/plugin.py", line 245, in pytest_load_initial_conftests
    dj_settings.DATABASES
  File "/usr/lib/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/kuba/temp/t2/pytest-django/pytest_django/plugin.py", line 118, in _handle_import_error
    raise ImportError(msg)
ImportError: cannot import name 'Settings'

pytest-django could not find a Django project (no manage.py file could be found). You must explicitly add your Django project to the Python path to have it picked up.
================================================================================================ warnings summary =================================================================================================
tests/test_fixtures.py::test_admin_client
  /home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/core/handlers/base.py:52: RemovedInDjango20Warning: Old-style middleware using settings.MIDDLEWARE_CLASSES is deprecated. Update your middleware and use settings.MIDDLEWARE instead.
    "instead.", RemovedInDjango20Warning

tests/test_fixtures.py::test_admin_client_no_db_marker
  /home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/core/handlers/base.py:52: RemovedInDjango20Warning: Old-style middleware using settings.MIDDLEWARE_CLASSES is deprecated. Update your middleware and use settings.MIDDLEWARE instead.
    "instead.", RemovedInDjango20Warning

tests/test_fixtures.py::TestLiveServer::()::test_url
  /home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/core/handlers/base.py:52: RemovedInDjango20Warning: Old-style middleware using settings.MIDDLEWARE_CLASSES is deprecated. Update your middleware and use settings.MIDDLEWARE instead.
    "instead.", RemovedInDjango20Warning

tests/test_urls.py::test_urls_client
  /home/kuba/temp/t2/pytest-django/lib/python3.5/site-packages/django/core/handlers/base.py:52: RemovedInDjango20Warning: Old-style middleware using settings.MIDDLEWARE_CLASSES is deprecated. Update your middleware and use settings.MIDDLEWARE instead.
    "instead.", RemovedInDjango20Warning

-- Docs: http://doc.pytest.org/en/latest/warnings.html
========================================================================== 3 failed, 130 passed, 1 skipped, 4 warnings in 58.16 seconds ===========================================================================
Makefile:8: recipe for target 'test' failed
make: *** [test] Error 1

I am on Ubuntu 16.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions