Skip to content

Commit

Permalink
os: Include posix functions in os.__all__. Closes issue python#18554.
Browse files Browse the repository at this point in the history
Patch by Ronald Oussoren.
  • Loading branch information
1st1 committed Sep 26, 2014
1 parent 4f6355f commit 97e2e06
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Lib/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ def _get_exports_list(module):
except ImportError:
pass

import posix
__all__.extend(_get_exports_list(posix))
del posix

elif 'nt' in _names:
name = 'nt'
linesep = '\r\n'
Expand Down
8 changes: 8 additions & 0 deletions Lib/test/test_os.py
Original file line number Diff line number Diff line change
Expand Up @@ -2616,6 +2616,13 @@ def test_blocking(self):
self.assertEqual(os.get_blocking(fd), True)



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(
Expand Down Expand Up @@ -2652,6 +2659,7 @@ def test_main():
FDInheritanceTests,
Win32JunctionTests,
BlockingTests,
ExportsTests,
)

if __name__ == "__main__":
Expand Down
2 changes: 2 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Release date: TBA
Core and Builtins
-----------------

- Issue #18554: os.__all__ includes posix functions.

- Issue #21391: Use os.path.abspath in the shutil module.

- Issue #11471: avoid generating a JUMP_FORWARD instruction at the end of
Expand Down

0 comments on commit 97e2e06

Please sign in to comment.