[issue35965] Behavior for unittest.assertRaisesRegex differs depending on whether it is used as a context manager

2019-02-11 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: No problem, after some debugging the statement finally executed is 'exec(compile("set.add(0)", "foo.py", "exec"))' . In Python interpreter this will give the expected error. It also gives the same error before coverage.start() [0] and gives a

[issue35965] Behavior for unittest.assertRaisesRegex differs depending on whether it is used as a context manager

2019-02-11 Thread SylvainDe
SylvainDe added the comment: I have no explanation whatsoever but removing the call to coverage seems to remove the issue: https://travis-ci.org/SylvainDe/DidYouMean-Python/builds/491727724 . I guess we can close this issue - sorry for the inconvenience. @nedbat: do you want me to open an

[issue35965] Behavior for unittest.assertRaisesRegex differs depending on whether it is used as a context manager

2019-02-11 Thread SylvainDe
SylvainDe added the comment: This is a brilliant idea! I'll give it a try and keep you posted. -- ___ Python tracker ___ ___

[issue35965] Behavior for unittest.assertRaisesRegex differs depending on whether it is used as a context manager

2019-02-11 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Is this something related to running under coverage? With the failure commit on Travis I built the binary and there are no failures with unittest but the tests fail with coverage. Running 'set.add(0)' under coverage and as normal file generates

[issue35965] Behavior for unittest.assertRaisesRegex differs depending on whether it is used as a context manager

2019-02-11 Thread SylvainDe
SylvainDe added the comment: That's the very weird thing. I've been unable to reproduce this locally but it can be seen on Travis runs. Here are the results so far (Versions numbers are retrieved with python -VV and python -c "import sys; print(sys._git)"): On some versions, both tests

[issue35965] Behavior for unittest.assertRaisesRegex differs depending on whether it is used as a context manager

2019-02-11 Thread Ronald Oussoren
Ronald Oussoren added the comment: On which Python versions do you see this problem? Both tests pass on my system (macOS 10.4.3) with Python 3.7.2, 3.6.3 and 3.5.5. -- nosy: +ronaldoussoren ___ Python tracker

[issue35965] Behavior for unittest.assertRaisesRegex differs depending on whether it is used as a context manager

2019-02-11 Thread SylvainDe
New submission from SylvainDe : On some Python versions, the following pieces of code have a different behavior which is not something I'd expect: ``` DESCRIPT_REQUIRES_TYPE_RE = r"descriptor '\w+' requires a 'set' object but received a 'int'" ... def