Commit Graph

15 Commits

Author SHA1 Message Date
Bruno Oliveira 7341da1bc1 Introduce pytest.mark.filterwarnings 2017-07-20 22:31:49 -03:00
Andras Tim 7248b759e8 Fixed E303 flake8 errors
too many blank lines (3)
2017-07-17 01:44:23 +02:00
Andras Tim b840622819 Fixed E302 flake8 errors
expected 2 blank lines, found 0
2017-07-17 01:44:23 +02:00
Andras Tim 6146ac97d9 Fixed E101 flake8 errors
indentation contains mixed spaces and tabs
2017-07-17 01:28:16 +02:00
Bruno Oliveira 9d41eaedbf Issue UnicodeWarning only for non-ascii unicode
Fix #2463
2017-06-05 10:43:15 -03:00
Bruno Oliveira 32e2642233 No longer override existing warning filters during warnings capture
Fix #2430
2017-05-30 17:17:36 -03:00
wanghui d7a5c5716f
Add UnicodeWarning for unicode warnings in Python2 2017-05-26 13:12:02 +08:00
wanghui c39689da41
Correct warnings with unicode message. 2017-05-25 17:59:42 +08:00
Bruno Oliveira 78194093af Improve warning representation in terminal plugin and fix tests 2017-03-16 21:57:32 -03:00
Bruno Oliveira 337f891d78 Fixed tests 2017-03-16 20:01:47 -03:00
Bruno Oliveira 272afa9422 Display node ids and the warnings generated by it
The rationale of using node ids is that users can copy/paste it to run a chosen test
2017-03-04 20:53:42 -03:00
Bruno Oliveira de09023e45 Also capture warnings during setup/teardown 2017-03-04 16:15:03 -03:00
Bruno Oliveira e24081bf76 Change warning output 2017-03-04 15:59:20 -03:00
Bruno Oliveira 82785fcd40 Use warnings.catch_warnings instead of WarningsRecorder
This has the benefical side-effect of not calling the original
warnings.showwarnings function, which in its original form
only writes the formatted warning to sys.stdout.

Calling the original warnings.showwarnings has the effect that nested WarningsRecorder all catch the warnings:

with WarningsRecorder() as rec1:
    with WarningsRecorder() as rec2:
        warnings.warn(UserWarning, 'some warning')

(both rec1 and rec2 sees the warning)

When running tests with `testdir`, the main pytest session would then see the warnings created by
the internal code being tested (if any), and the main pytest session would end up with warnings as well.
2017-02-18 13:08:14 -02:00
Bruno Oliveira 26ca5a702e Add tests and integrated the original code into the core 2016-11-21 08:26:43 -02:00