question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should avoid global seterr calls in test files

See original GitHub issue

From 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:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
NicolasHugcommented, Apr 17, 2019

pytest path_to_file

e.g.

pytest sklearn/neural_network/tests/test_mlp.py

also see some useful tips here

0reactions
aditya1702commented, Apr 17, 2019

@NicolasHug I will make a PR. Also, how do you run individual test files?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found