Skip to content
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

Fix minor bug preventing the use of native pytest command #1520

Merged
merged 1 commit into from
Feb 12, 2018

Conversation

drdavella
Copy link
Collaborator

This allows the native pytest command to be used to run the test suite. Consequently, it should be easier to run specific test modules and test cases since all native pytest command line options are available.

Am I starting to sound like a broken record? 😉

This isn't included in this changeset, but it might be worth considering using the pytest-runner package instead of providing a custom setuptools command for testing.

@astrofrog
Copy link
Member

Huh I've actually been using pytest to run the test suite here for a while (I'm surprised the change here is needed). I don't really use the test` command in setup.py`` so we could remove it.

@drdavella
Copy link
Collaborator Author

Weird. 🤔

Here's what I get before that change (on latest master):

============================= test session starts ==============================
platform darwin -- Python 3.6.4, pytest-3.3.2, py-1.5.2, pluggy-0.6.0
rootdir: /Users/ddavella/glue, inifile: pytest.ini
collected 0 items / 1 errors

==================================== ERRORS ====================================
______________________________ ERROR collecting  _______________________________
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/_pytest/config.py:328: in _getconftestmodules
    return self._path2confmods[path]
E   KeyError: local('/Users/ddavella/glue/glue')

During handling of the above exception, another exception occurred:
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/_pytest/config.py:359: in _importconftest
    return self._conftestpath2mod[conftestpath]
E   KeyError: local('/Users/ddavella/glue/glue/conftest.py')

During handling of the above exception, another exception occurred:
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/py/_path/common.py:377: in visit
    for x in Visitor(fil, rec, ignore, bf, sort).gen(self):
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/py/_path/common.py:418: in gen
    dirs = self.optsort([p for p in entries
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/py/_path/common.py:419: in <listcomp>
    if p.check(dir=1) and (rec is None or rec(p))])
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/_pytest/main.py:765: in _recurse
    ihook = self.gethookproxy(path)
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/_pytest/main.py:669: in gethookproxy
    my_conftestmodules = pm._getconftestmodules(fspath)
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/_pytest/config.py:342: in _getconftestmodules
    mod = self._importconftest(conftestpath)
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/_pytest/config.py:378: in _importconftest
    self.consider_conftest(mod)
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/_pytest/config.py:401: in consider_conftest
    self.register(conftestmodule, name=conftestmodule.__file__)
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/_pytest/config.py:250: in register
    ret = super(PytestPluginManager, self).register(plugin, name)
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/pluggy/__init__.py:254: in register
    hook._maybe_apply_history(hookimpl)
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/pluggy/__init__.py:650: in _maybe_apply_history
    res = self._hookexec(self, [method], kwargs)
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/pluggy/__init__.py:222: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/pluggy/__init__.py:216: in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
glue/conftest.py:29: in pytest_configure
    if config.getoption('no_optional_skip'):
../miniconda3/envs/cubeviz-regions/lib/python3.6/site-packages/_pytest/config.py:1225: in getoption
    raise ValueError("no option named %r" % (name,))
E   ValueError: no option named 'no_optional_skip'
!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!
=========================== 1 error in 1.40 seconds ============================

@astrofrog astrofrog merged commit 2d6bf6d into glue-viz:master Feb 12, 2018
@drdavella drdavella deleted the fix-pytest branch February 12, 2018 22:14
@astrofrog astrofrog modified the milestones: v0.12.4, v0.12.5 Mar 7, 2018
astrofrog added a commit that referenced this pull request Mar 7, 2018
Fix minor bug preventing the use of native pytest command
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

Successfully merging this pull request may close these issues.

2 participants