Message247167
Here is a brainstorm of alternatives that don’t require passing “self” into a helper function. But IMO the current proposal that does pass “self” is better.
* Passive expected_module_api() function, and manually check the return value. Precedent: support.detect_api_mismatch().
def test_all(self): # In class test.test_tarfile.MiscTest
blacklist = {"bltn_open", ...}
possible_exports = support.expected_module_api(tarfile, ignore=blacklist)
self.assertCountEqual(ftplib.__all__, possible_exports)
* ModuleApiTestBase class. Subclass it to use it:
class ExportsTest(support.ModuleApiTestBase): # In module test.test_tarfile
module = tarfile
ignore = {"bltn_open", ...}
* Raise AssertionError directly in case of failure. No automatic error message showing the different names though. Precedents: support.run_doctest(), .check_warnings(), script_helper.assert_python_ok(), _failure().
* Make a temporary internal TestCase instance:
def check__all__(module, etc):
expected = ...
...
TestCase().assertCountEqual(module.__all__, expected) |
|
Date |
User |
Action |
Args |
2015-07-23 05:14:22 | martin.panter | set | recipients:
+ martin.panter, r.david.murray, python-dev, berker.peksag, serhiy.storchaka, milap.py, maurosr, taddeimania, Unit03 |
2015-07-23 05:14:21 | martin.panter | set | messageid: <1437628461.84.0.682816821253.issue23883@psf.upfronthosting.co.za> |
2015-07-23 05:14:21 | martin.panter | link | issue23883 messages |
2015-07-23 05:14:20 | martin.panter | create | |
|