param icon indicating copy to clipboard operation
param copied to clipboard

Enable warnings as errors for param's test suite

Open ceball opened this issue 8 years ago • 5 comments

Once the current warnings have first been displayed (#86), then fixed, we should make warnings be errors.

Set param.parameterized.warnings_as_exceptions=True before nose runs, maybe.

ceball avatar Oct 26 '17 21:10 ceball

Let us decide if this is something we really want to do. There are a lot of warnings. This one could hurt folks.

tonyfast avatar Aug 17 '20 15:08 tonyfast

To be clear, I'm suggesting to enable param's own "warnings as errors" for one of param's test environments. This does not even need to be the default mode for running the test suite, just so long as at least one test environment on travis does it. I.e. this would have no impact on anyone else (external user, packager, or even tester of param).

In the same PR, would need to fix any errors being raised (i.e. cases where param's own test suite is generating warnings from param), e.g.

Screenshot from 2020-09-13 15-34-43

This env would only be running the API1 tests, I assume.

If possible/practical, I would also like to go further and catch other kinds of warnings, too, e.g. deprecation and future warnings. Seems like that might become possible after #423 - adding something like -W error::DeprecationWarning -W error::FutureWarning to the pytest call. Again, this would not be the default mode of running the test suite, just one test environment on travis.

ceball avatar Sep 13 '20 14:09 ceball

Sounds good to me. I assume it would be API2 tests, though; not much point in testing API1 anymore.

jbednar avatar Sep 13 '20 17:09 jbednar

The tests call them API0 and API1 (I guess it was a comment on amount of thought/actual APIness 😅)

ceball avatar Sep 18 '20 06:09 ceball

I was wondering about this today when I saw:

nosetests testwatch.py
......................WARNING:param.SimpleWatchExample00023: No such watcher Watcher(inst=SimpleWatchExample(a=0, b=0, c=0, d=0, e=False, f=False, name='SimpleWatchExample00023'), cls=<class 'tests.API1.testwatch.SimpleWatchExample'>, fn=<function TestWatch.test_warning_unwatching_when_unwatched.<locals>.accumulator at 0x104b1ec80>, mode='args', onlychanged=True, parameter_names=('a',), what='value', queued=False) to remove.
...................
----------------------------------------------------------------------
Ran 41 tests in 0.016s

OK

I can't tell at a glance if that warning is a mistake in the test definitions or expected to happen (if the latter, there should be a way to suppress it). I support warnings as errors to avoid this kind of confusion!

jlstevens avatar Sep 23 '20 12:09 jlstevens