Skip to content

Difficulties with the testing #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
schtibe opened this issue Apr 20, 2016 · 6 comments
Closed

Difficulties with the testing #228

schtibe opened this issue Apr 20, 2016 · 6 comments

Comments

@schtibe
Copy link
Contributor

schtibe commented Apr 20, 2016

I still have difficulties running the tests. Following steps were taken:

  1. cloned the repo
  2. ran pip install -e
  3. ran python runtests.py

Now I get following output (truncated)

============================================================================================================= test session starts =============================================================================================================
platform linux -- Python 3.5.1 -- py-1.4.30 -- pytest-2.7.2
django settings: example.settings.test (from ini file)
rootdir: /home/sh/coding/contributing/django-rest-framework-json-api, inifile: pytest.ini
plugins: django, factoryboy
collected 3 items / 16 errors 

example/tests/test_multiple_id_mixin.py ..
example/tests/test_sideload_resources.py .

=================================================================================================================== ERRORS ====================================================================================================================
_____________________________________________________________________________________________ ERROR collecting example/tests/test_format_keys.py ______________________________________________________________________________________________
_pytest.runner:149: in __init__
    ???
_pytest.main:437: in _memocollect
    ???
_pytest.main:314: in _memoizedcall
    ???
_pytest.main:437: in 
    ???
_pytest.python:482: in collect
    ???
_pytest.python:1750: in parsefactories
    ???
_pytest.python:266: in fget
    ???
_pytest.python:479: in _getobj
    ???
_pytest.main:314: in _memoizedcall
    ???
_pytest.python:488: in _importtestmodule
    ???
py._path.local:650: in pyimport
    ???
:969: in _find_and_load
    ???
:954: in _find_and_load_unlocked
    ???
:892: in _find_spec
    ???
:873: in _find_spec_legacy
    ???
_pytest.assertion.rewrite:137: in find_module
    ???
_pytest.assertion.rewrite:278: in _rewrite_test
    ???
_pytest.assertion.rewrite:336: in rewrite_asserts
    ???
_pytest.assertion.rewrite:557: in run
    ???
/usr/lib/python3.5/ast.py:245: in visit
    return visitor(node)
_pytest.assertion.rewrite:665: in visit_Assert
    ???
/usr/lib/python3.5/ast.py:245: in visit
    return visitor(node)
_pytest.assertion.rewrite:796: in visit_Compare
    ???
/usr/lib/python3.5/ast.py:245: in visit
    return visitor(node)
_pytest.assertion.rewrite:700: in visit_Name
    ???
E   TypeError: Call constructor takes either 0 or 3 positional arguments

This output repeats for every test...

Now, as a sidenote, I actually don't like having all this stuff globally on my OS, so I tried with a virtualenv too. What then happens is following error:

============================================================================================================= test session starts =============================================================================================================
platform linux -- Python 3.5.1 -- py-1.4.30 -- pytest-2.7.2
rootdir: /home/sh/coding/contributing/django-rest-framework-json-api, inifile: pytest.ini
collected 0 items / 1 errors 

=================================================================================================================== ERRORS ====================================================================================================================
______________________________________________________________________________________________________________ ERROR collecting  ______________________________________________________________________________________________________________
_pytest.runner:149: in __init__
    ???
_pytest.main:437: in _memocollect
    ???
_pytest.main:314: in _memoizedcall
    ???
_pytest.main:437: in 
    ???
_pytest.main:594: in collect
    ???
_pytest.main:609: in _collect
    ???
py._path.common:332: in visit
    ???
py._path.common:378: in gen
    ???
py._path.common:367: in gen
    ???
py._path.common:368: in 
    ???
_pytest.main:632: in _recurse
    ???
_pytest.main:162: in __getattr__
    ???
_pytest.config:692: in _getmatchingplugins
    ???
_pytest.config:521: in getconftestmodules
    ???
_pytest.config:545: in importconftest
    ???
E   _pytest.config.ConftestImportFailure: (local('/home/sh/coding/contributing/django-rest-framework-json-api/example/tests/conftest.py'), (, ImproperlyConfigured('Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.',), ))

I'm not familiar with pytest at all. A little more guidance for running those tests would be very nice :)

@jerel
Copy link
Member

jerel commented Apr 20, 2016

You also need to install the dependencies via pip install -r requirements-development.txt

@schtibe
Copy link
Contributor Author

schtibe commented Apr 21, 2016

@jerel doesn't help, still get the errors in the first dump

@jerel
Copy link
Member

jerel commented Apr 21, 2016

Is that with a virtualenv active? I didn't mention that earlier but that is the way you should run it.

@schtibe
Copy link
Contributor Author

schtibe commented Apr 21, 2016

Yes. I recorded it, maybe you see the fault there: http://www.pasteall.org/pic/show.php?id=102247

@abdulhaq-e
Copy link
Contributor

py.test deprecated the generation of test scripts, see: https://pytest.org/latest/goodpractices.html#deprecated-create-a-pytest-standalone-script

Try running the tests using just py.test.

@schtibe
Copy link
Contributor Author

schtibe commented Apr 25, 2016

@abdulhaq-e thank you sir!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants