[issue26742] imports in test_warnings changes warnings.filters

2016-05-21 Thread Martin Panter

Martin Panter added the comment:

I suggest to use the patch from Issue 18383.

--
resolution:  -> duplicate
status: open -> closed
superseder:  -> test_warnings modifies warnings.filters when running with "-W 
default"

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26742] imports in test_warnings changes warnings.filters

2016-04-12 Thread Martin Panter

Martin Panter added the comment:

Hmm your patch is a variation of the first patch in Issue 18383, and Serhiy’s 
comment about not fixing the underlying problem would apply: 
.

I can’t remember all the details now, but it sounds like Alex’s later patch may 
be a slightly more desirable hack :)

--
nosy: +martin.panter

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26742] imports in test_warnings changes warnings.filters

2016-04-12 Thread STINNER Victor

New submission from STINNER Victor:

---
$ ./python -Wd -m test -j0 test_warnings
Run tests in parallel using 6 child processes
0:00:01 [1/1] test_warnings
(...)
Warning -- warnings.filters was modified by test_warnings
1 test altered the execution environment:
test_warnings
Total duration: 0:00:02
---

The problem are these two lines in test_warnings/__init__.py:
---
py_warnings = support.import_fresh_module('warnings', blocked=['_warnings'])
c_warnings = support.import_fresh_module('warnings', fresh=['_warnings'])
---

Each fresh "import warnings" calls _processoptions(sys.warnoptions) which can 
change warning filters.

Attached patch saves/restores warnings.filter to fix the resource warning from 
the test suite.

Note: the warning is not emited if tests are run sequentially (without the -jN 
option).

--
files: test_warnings.patch
keywords: patch
messages: 263291
nosy: haypo
priority: normal
severity: normal
status: open
title: imports in test_warnings changes warnings.filters
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42449/test_warnings.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com