-
-
Notifications
You must be signed in to change notification settings - Fork 335
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 --run-slow test option #330
Conversation
Use the pattern described in https://docs.pytest.org/en/latest/example/simple.html
Do you know why you're getting this error? I'm confused by the traceback
showing unittest/loader.py given that we don't use unittest...
…On Sep 26, 2017 04:42, "Matthias Urlichs" ***@***.***> wrote:
Symptom:
ERROR: trio._core.tests.test_ki (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: trio._core.tests.test_ki
Traceback (most recent call last):
File "/usr/lib/python3.6/unittest/loader.py", line 428, in _find_test_path
module = self._get_module_from_name(name)
File "/usr/lib/python3.6/unittest/loader.py", line 369, in _get_module_from_name
__import__(name)
File "/home/smurf/src/trio/.pybuild/pythonX.Y_3.6/build/trio/_core/tests/test_ki.py", line 15, in <module>
from .tutil import slow
File "/home/smurf/src/trio/.pybuild/pythonX.Y_3.6/build/trio/_core/tests/tutil.py", line 9, in <module>
not pytest.config.getoption("--run-slow", True),
AttributeError: module 'pytest' has no attribute 'config'
Fix:
Use the pattern described in
https://docs.pytest.org/en/latest/example/simple.html
------------------------------
You can view, comment on, or merge this pull request online at:
#330
Commit Summary
- Fix --run-slow test option
File Changes
- *M* trio/_core/tests/test_ki.py
<https://github.com/python-trio/trio/pull/330/files#diff-0> (3)
- *M* trio/_core/tests/test_multierror.py
<https://github.com/python-trio/trio/pull/330/files#diff-1> (8)
- *M* trio/_core/tests/tutil.py
<https://github.com/python-trio/trio/pull/330/files#diff-2> (7)
- *M* trio/tests/conftest.py
<https://github.com/python-trio/trio/pull/330/files#diff-3> (8)
- *M* trio/tests/test_highlevel_open_tcp_listeners.py
<https://github.com/python-trio/trio/pull/330/files#diff-4> (3)
- *M* trio/tests/test_ssl.py
<https://github.com/python-trio/trio/pull/330/files#diff-5> (4)
- *M* trio/tests/test_threads.py
<https://github.com/python-trio/trio/pull/330/files#diff-6> (1)
Patch Links:
- https://github.com/python-trio/trio/pull/330.patch
- https://github.com/python-trio/trio/pull/330.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#330>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAlOaJZR4UCO7wej5kX25pUWhtbmncaBks5smOK4gaJpZM4PkG38>
.
|
The trigger was that I was playing naïve and started "setup.py test". That doesn't work even after applying this patch (there's a way to teach setup.py to use pytest instead …) for some interesting reasons; however, I've seen variations of this sort of problem with pytest in other projects – which could easily be fixed by switching to the canonical way of handling this usecase. Thus I'd suggest applying this change. |
Okay, finally had a little more time to look at this. Sorry for the wait, and thanks for taking the time to put this together! The details are, like everything involving testing and especially pytest, bizarrely complicated... First, the patch currently causes a regression: a hook in I'm also uncertain whether this works if you use Before we get too far into these details though there's the question of whether this is useful. I think we could fix that specific error message by just adding an Also I pretty much 100% don't care about supporting Well, I guess making OTOH, this change is pretty harmless (if the specific issues mentioned above are sorted out) and maybe using the mark mechanism is independently nice in some rare corner cases like doing |
Closing/re-opening to redo CI now that #336 is merged. |
Codecov Report
@@ Coverage Diff @@
## master #330 +/- ##
=========================================
- Coverage 99.24% 99.2% -0.05%
=========================================
Files 87 87
Lines 10384 10385 +1
Branches 730 733 +3
=========================================
- Hits 10306 10302 -4
- Misses 61 65 +4
- Partials 17 18 +1
Continue to review full report at Codecov.
|
OK, alternate solution: Writing Plug-ins says:
|
… and getting setup.py to run pytest when calling One of the reasons I want that is that some build systems (like Debian's) auto-call |
This has stalled out and it's not clear to me whether there's anything here, so I'm going to close and we can re-open later if appropriate. |
Symptom:
Fix:
Use the pattern described in
https://docs.pytest.org/en/latest/example/simple.html