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

flaky doesn't work with py.test --doctest-modules #34

Closed
kmike opened this issue Apr 15, 2015 · 1 comment · Fixed by #37
Closed

flaky doesn't work with py.test --doctest-modules #34

kmike opened this issue Apr 15, 2015 · 1 comment · Fixed by #37
Assignees

Comments

@kmike
Copy link

kmike commented Apr 15, 2015

When doctests are enabled in pytest and flaky is installed, pytest raises an error when collecting the tests:

(splash)kmike ~/svn/splash [master+?]> py.test --doctest-modules splash
============================================================= test session starts =============================================================
platform darwin -- Python 2.7.5 -- py-1.4.26 -- pytest-2.6.4
plugins: flaky, greendots, xdist
collected 1035 items 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/_pytest/main.py", line 84, in wrap_session
INTERNALERROR>     doit(config, session)
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/_pytest/main.py", line 122, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
INTERNALERROR>     return self._docall(methods, kwargs)
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
INTERNALERROR>     res = mc.execute()
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
INTERNALERROR>     res = method(**kwargs)
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/_pytest/main.py", line 142, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/_pytest/core.py", line 413, in __call__
INTERNALERROR>     return self._docall(methods, kwargs)
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/_pytest/core.py", line 424, in _docall
INTERNALERROR>     res = mc.execute()
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/_pytest/core.py", line 315, in execute
INTERNALERROR>     res = method(**kwargs)
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/flaky/flaky_pytest_plugin.py", line 18, in pytest_runtest_protocol
INTERNALERROR>     PLUGIN.run_test(item, nextitem)
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/flaky/flaky_pytest_plugin.py", line 102, in run_test
INTERNALERROR>     self._copy_flaky_attributes(item, test_instance)
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/flaky/_flaky_plugin.py", line 253, in _copy_flaky_attributes
INTERNALERROR>     test_callable, _ = cls._get_test_callable_and_name(test)
INTERNALERROR>   File "/Users/kmike/envs/splash/lib/python2.7/site-packages/flaky/flaky_pytest_plugin.py", line 222, in _get_test_callable_and_name
INTERNALERROR>     elif hasattr(test.module, callable_name):
INTERNALERROR> AttributeError: 'DoctestItem' object has no attribute 'module'
@Jeff-Meadows
Copy link
Contributor

Thanks for the report - I'll check it out.

@Jeff-Meadows Jeff-Meadows self-assigned this Apr 15, 2015
Jeff-Meadows added a commit to Jeff-Meadows/flaky that referenced this issue Apr 17, 2015
This allows the same test declaration to be collected multiple times without problems.
Also fixes a documentation error.
Fixes box#36 Fixes box#34 Fixes box#33
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 a pull request may close this issue.

2 participants