diff --git a/Lib/os.py b/Lib/os.py --- a/Lib/os.py +++ b/Lib/os.py @@ -61,6 +61,10 @@ except ImportError: pass + import posix + __all__.extend(_get_exports_list(posix)) + del posix + elif 'nt' in _names: name = 'nt' linesep = '\r\n' diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2252,6 +2252,13 @@ else: self.skipTest("Could not determine the number of CPUs") + +class ExportsTests(unittest.TestCase): + def test_os_all(self): + self.assertIn('open', os.__all__) + self.assertIn('walk', os.__all__) + + @support.reap_threads def test_main(): support.run_unittest( @@ -2284,6 +2291,7 @@ OSErrorTests, RemoveDirsTests, CPUCountTests, + ExportsTests, ) if __name__ == "__main__":