Author martin.panter
Recipients Unit03, berker.peksag, martin.panter, maurosr,, python-dev, r.david.murray, serhiy.storchaka, taddeimania
Date 2015-07-23.05:14:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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:22martin.pantersetrecipients: + martin.panter, r.david.murray, python-dev, berker.peksag, serhiy.storchaka,, maurosr, taddeimania, Unit03
2015-07-23 05:14:21martin.pantersetmessageid: <>
2015-07-23 05:14:21martin.panterlinkissue23883 messages
2015-07-23 05:14:20martin.pantercreate