[Python-checkins] bpo-31904: Fix fifo test cases for VxWorks (GH-20254)

vstinner webhook-mailer at python.org
Tue Dec 1 03:20:58 EST 2020


https://github.com/python/cpython/commit/b2d0c66e881301ed8908da3cb41bbf253c449b0c
commit: b2d0c66e881301ed8908da3cb41bbf253c449b0c
branch: master
author: pxinwr <peixing.xin at windriver.com>
committer: vstinner <vstinner at python.org>
date: 2020-12-01T09:20:50+01:00
summary:

bpo-31904: Fix fifo test cases for VxWorks (GH-20254)

files:
A Misc/NEWS.d/next/Tests/2020-05-20-14-28-48.bpo-31904.yJik6k.rst
M Lib/test/test_posix.py
M Lib/test/test_stat.py

diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index a522717751ac1..18afbef082bff 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -642,12 +642,17 @@ def test_stat(self):
 
     @unittest.skipUnless(hasattr(posix, 'mkfifo'), "don't have mkfifo()")
     def test_mkfifo(self):
-        os_helper.unlink(os_helper.TESTFN)
+        if sys.platform == "vxworks":
+            fifo_path = os.path.join("/fifos/", os_helper.TESTFN)
+        else:
+            fifo_path = os_helper.TESTFN
+        os_helper.unlink(fifo_path)
+        self.addCleanup(os_helper.unlink, fifo_path)
         try:
-            posix.mkfifo(os_helper.TESTFN, stat.S_IRUSR | stat.S_IWUSR)
+            posix.mkfifo(fifo_path, stat.S_IRUSR | stat.S_IWUSR)
         except PermissionError as e:
             self.skipTest('posix.mkfifo(): %s' % e)
-        self.assertTrue(stat.S_ISFIFO(posix.stat(os_helper.TESTFN).st_mode))
+        self.assertTrue(stat.S_ISFIFO(posix.stat(fifo_path).st_mode))
 
     @unittest.skipUnless(hasattr(posix, 'mknod') and hasattr(stat, 'S_IFIFO'),
                          "don't have mknod()/S_IFIFO")
@@ -1929,7 +1934,7 @@ def test_posix_spawnp(self):
 class TestPosixWeaklinking(unittest.TestCase):
     # These test cases verify that weak linking support on macOS works
     # as expected. These cases only test new behaviour introduced by weak linking,
-    # regular behaviour is tested by the normal test cases. 
+    # regular behaviour is tested by the normal test cases.
     #
     # See the section on Weak Linking in Mac/README.txt for more information.
     def setUp(self):
diff --git a/Lib/test/test_stat.py b/Lib/test/test_stat.py
index 83d09e17f93c5..2e1e2c349c8d0 100644
--- a/Lib/test/test_stat.py
+++ b/Lib/test/test_stat.py
@@ -2,6 +2,7 @@
 import os
 import socket
 import sys
+from test.support import os_helper
 from test.support import socket_helper
 from test.support.import_helper import import_fresh_module
 from test.support.os_helper import TESTFN
@@ -173,11 +174,16 @@ def test_link(self):
 
     @unittest.skipUnless(hasattr(os, 'mkfifo'), 'os.mkfifo not available')
     def test_fifo(self):
+        if sys.platform == "vxworks":
+            fifo_path = os.path.join("/fifos/", TESTFN)
+        else:
+            fifo_path = TESTFN
+        self.addCleanup(os_helper.unlink, fifo_path)
         try:
-            os.mkfifo(TESTFN, 0o700)
+            os.mkfifo(fifo_path, 0o700)
         except PermissionError as e:
             self.skipTest('os.mkfifo(): %s' % e)
-        st_mode, modestr = self.get_mode()
+        st_mode, modestr = self.get_mode(fifo_path)
         self.assertEqual(modestr, 'prwx------')
         self.assertS_IS("FIFO", st_mode)
 
diff --git a/Misc/NEWS.d/next/Tests/2020-05-20-14-28-48.bpo-31904.yJik6k.rst b/Misc/NEWS.d/next/Tests/2020-05-20-14-28-48.bpo-31904.yJik6k.rst
new file mode 100644
index 0000000000000..40caa88d689a2
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2020-05-20-14-28-48.bpo-31904.yJik6k.rst
@@ -0,0 +1 @@
+Fix fifo test cases for VxWorks RTOS.



More information about the Python-checkins mailing list