This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients Unit03, berker.peksag, martin.panter, maurosr, milap.py, 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 <1437628461.84.0.682816821253.issue23883@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2015-07-23 05:14:22martin.pantersetrecipients: + martin.panter, r.david.murray, python-dev, berker.peksag, serhiy.storchaka, milap.py, maurosr, taddeimania, Unit03
2015-07-23 05:14:21martin.pantersetmessageid: <1437628461.84.0.682816821253.issue23883@psf.upfronthosting.co.za>
2015-07-23 05:14:21martin.panterlinkissue23883 messages
2015-07-23 05:14:20martin.pantercreate