Should avoid global seterr calls in test files
See original GitHub issueFrom https://github.com/scikit-learn/scikit-learn/issues/5664#issuecomment-246439919, there are global seterr in test files:
sklearn/neural_network/tests/test_mlp.py:np.seterr(all='warn')
sklearn/neural_network/tests/test_rbm.py:np.seterr(all='warn')
Having this set globally affects other test files, and does not necessarily set the error state for the tests in that file. We should instead use a fixture to enable warnings, or use errstate
in tests that need it.
On the other hand, we should consider investigating and avoiding these numpy errors where possible.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Should we test all our methods?
Ideally you should be testing logical code, but interactions (objects calling other objects) are equally important. In your case, I would.
Read more >Avoid Nesting when you're Testing - Kent C. Dodds
I want to show you something. What I'm going to show is a general testing principle, applied to a React component test.
Read more >Testing a function with static global variable in Ceedling
Can I mock this setter function in CMock? I have been doing some reading and it seems like CMock cannot mock a function...
Read more >The Jest Object
The jest object is automatically in scope within every test file. ... When using babel-jest , calls to disableAutomock() will automatically ...
Read more >Python's assert: Debug and Test Your Code Like a Pro
When Not to Use Assertions? Understanding Python's assert Statements. The Syntax of the assert Statement; The AssertionError Exception.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
pytest path_to_file
e.g.
pytest sklearn/neural_network/tests/test_mlp.py
also see some useful tips here
@NicolasHug I will make a PR. Also, how do you run individual test files?