-
Carlos Ramos Carreño authored
The tests for gpython's handling of warning filters assumed that the warnings passed in the command line were located on the top of the warning filters list. This is not true in the presence of automatically imported modules that set warning filters, such as `_distutils_hack`, which [used to filter deprecation warnings from distutils](https://github.com/pypa/setuptools/commit/5d60ccefb48329b7cedfe6d78fc1cb95683104b6). We fix it by comparing against a regex which allows extra filters above or below the ones we set. -------- kirr: setuptools in between v55 to v60.3.1 was installing 'ignore' 'distutils deprecated' DeprecationWarning filter referenced above. As the result with such setuptools test_pymain was failing: > assert _.startswith( b"sys.warnoptions: ['ignore', 'world', 'error::SyntaxWarning']\n\n" + \ b"warnings.filters:\n" + \ b"- error::SyntaxWarning::*\n" + \ b"- ignore::Warning::*\n"), _ E AssertionError: b"sys.warnoptions: ['ignore', 'world', 'error::SyntaxWarning'] E E warnings.filters: E - ignore:.+ distutils\\b.+ deprec...::PendingDeprecationWarning::* <-- NOTE E - ignore::ImportWarning::* E - ignore::ResourceWarning::* E - ignore::PEP440Warning::* E " ... Since now we only selectively check for the presence of gpython should-be installed filters, it is also ok to remove explicit `grep -v for ignore:sys.exc_clear:DeprecationWarning:threading` on py2. /reviewed-by @kirr /reviewed-on kirr/pygolang!1
d10200c8