summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2014-09-26 16:33:06 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2014-09-26 16:33:06 (GMT)
commit97e2e06af84942c1d776df9660aa5f8dd30f222c (patch)
treecdc7af13f35813dd40a735f9f9492fb6999c3a2d
parent4f6355f8618bd463abe9dfe647ba60dcf2d71546 (diff)
downloadcpython-97e2e06af84942c1d776df9660aa5f8dd30f222c.zip
cpython-97e2e06af84942c1d776df9660aa5f8dd30f222c.tar.gz
cpython-97e2e06af84942c1d776df9660aa5f8dd30f222c.tar.bz2
os: Include posix functions in os.__all__. Closes issue #18554.
Patch by Ronald Oussoren.
-rw-r--r--Lib/os.py4
-rw-r--r--Lib/test/test_os.py8
-rw-r--r--Misc/NEWS2
3 files changed, 14 insertions, 0 deletions
diff --git a/Lib/os.py b/Lib/os.py
index 556f592..3bb0f4e 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -61,6 +61,10 @@ if 'posix' in _names:
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
index 020d0fa..6281596 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -2616,6 +2616,13 @@ class BlockingTests(unittest.TestCase):
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(
@@ -2652,6 +2659,7 @@ def test_main():
FDInheritanceTests,
Win32JunctionTests,
BlockingTests,
+ ExportsTests,
)
if __name__ == "__main__":
diff --git a/Misc/NEWS b/Misc/NEWS
index 9cb9e23..fb018be 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -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