[MRG] TST: skip test requiring internet using --skip-network#12067
[MRG] TST: skip test requiring internet using --skip-network#12067jnothman merged 4 commits intoscikit-learn:masterfrom
Conversation
|
@yarikoptic this should allow you to skip the remaining test that requires internet |
conftest.py
Outdated
|
|
||
|
|
||
| def pytest_runtest_setup(item): | ||
| if 'network' in item.keywords and item.config.getoption("--skip-network"): |
There was a problem hiding this comment.
Does this run for you locally? Travis CI doesn't seem to be happy although it is the same setup as pandas..
There was a problem hiding this comment.
Yep it passes locally. I did not find to reproduce the error yet. I should try the to reproduce the testing environment.
There was a problem hiding this comment.
I follow the pytest documentation. It seems that this is working but I did not find the root of the previous issue.
rth
left a comment
There was a problem hiding this comment.
Minor comments below, otherwise LGTM, thanks!
conftest.py
Outdated
| if item.name == 'sklearn.feature_extraction.hashing.FeatureHasher': | ||
| item.add_marker(skip_marker) | ||
|
|
||
| # Skip test which required internet if the flag is provided |
There was a problem hiding this comment.
"test" -> "tests"
"required" -> "require"
conftest.py
Outdated
|
|
||
| # Skip test which required internet if the flag is provided | ||
| if config.getoption("--skip-network"): | ||
| skip_network = pytest.mark.skip(reason="test required internet") |
There was a problem hiding this comment.
Maybe,
"test requires network connectivity"
jnothman
left a comment
There was a problem hiding this comment.
How do we ensure that this flag is used in appropriate places?
|
Never mind that last comment. I suppose pinging @yarikoptic should be good enough? |
jnothman
left a comment
There was a problem hiding this comment.
I only wonder if there is a somewhat standard nomenclature/interface here, or if we're just doing it as we like.
|
This is the way documented in pytest |
closes #12013
This should skip the test in gradient boosting if we have an issue with internet.
The flag
--skip-networkshould be passed when running the test withpytest.