[issue37890] Modernize several tests in test_importlib

2019-08-22 Thread Kyle Stanley
Kyle Stanley added the comment: > I would just read through the other tests files under test_importlib to see > how other tests were done. Okay, I'll start with that and report back with any ideas for potential changes to test_pkg_import. Thanks. --

[issue37890] Modernize several tests in test_importlib

2019-08-22 Thread Brett Cannon
Brett Cannon added the comment: I would just read through the other tests files under test_importlib to see how other tests were done. -- ___ Python tracker ___ _

[issue37890] Modernize several tests in test_importlib

2019-08-21 Thread Kyle Stanley
Kyle Stanley added the comment: > A key question here is why are you trying to avoid the AttributeError case so > much? > but there's a reason that we don't have attribute existence tests before > every single attribute access throughout the test suite Hmm, good point. I may have been fixat

[issue37890] Modernize several tests in test_importlib

2019-08-21 Thread Brett Cannon
Brett Cannon added the comment: A key question here is why are you trying to avoid the AttributeError case so much? If something has a bug and an attribute doesn't exist that should then that's a bug and the test needs to catch that. Now whether that's via an error from AttributeError being

[issue37890] Modernize several tests in test_importlib

2019-08-20 Thread Kyle Stanley
Kyle Stanley added the comment: > This might be a decent way to prevent the AttributeErrors, but still allows > for differentiation of actual None values Another alternative solution might be to use hasattr() before getattr(), if it is not desirable for test_pkg_import.py to raise exceptions

[issue37890] Modernize several tests in test_importlib

2019-08-20 Thread Kyle Stanley
Kyle Stanley added the comment: Ah okay, I wasn't sure what exactly would be involved with the "modernization" process, so those points were just rough ideas more than anything. I haven't started working on anything yet since I figured it'd be worthwhile to wait for approval first. > 1) __i

[issue37890] Modernize several tests in test_importlib

2019-08-20 Thread Brett Cannon
Brett Cannon added the comment: What Serhiy said. :) There's code to be able to easily test both builtins.__import__ and importlib.__import__ in tests so that there's no drift between the two implementations. -- ___ Python tracker

[issue37890] Modernize several tests in test_importlib

2019-08-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: 1) __import__() can be used for purpose. I would not change this. 3) How would you distinguish the case when the module have an attribute with the value is None and when it does not have the attribute at all? This information would lost with your change.

[issue37890] Modernize several tests in test_importlib

2019-08-19 Thread Kyle Stanley
Change by Kyle Stanley : -- stage: -> needs patch type: -> enhancement ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue37890] Modernize several tests in test_importlib

2019-08-19 Thread Kyle Stanley
Change by Kyle Stanley : -- nosy: +eric.snow, ncoghlan ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:

[issue37890] Modernize several tests in test_importlib

2019-08-19 Thread Kyle Stanley
Kyle Stanley added the comment: I'm not entirely certain as to which parts should be modernized, and which ones can remain the same. A large part of my uncertainty is that there are no header comments for "test_pkg_import.py" to explain the test coverage, so I don't know if there are additio

[issue37890] Modernize several tests in test_importlib

2019-08-19 Thread Kyle Stanley
New submission from Kyle Stanley : Last month, several tests were moved into test_importlib (https://bugs.python.org/issue19696): "test_pkg_import.py", "test_threaded_import.py", and "threaded_import_hangers.py". Those tests were created quite a while ago though and do not currently utilize