From e4f93fcf95516e3962ad2fdff236b4817ad7944c Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 29 Nov 2022 08:59:39 -0700 Subject: Polish test skipping in a couple of FW tests [skip appveyor] Signed-off-by: Mats Wichmann --- testing/framework/TestCmdTests.py | 26 +++++--------------------- testing/framework/TestCommonTests.py | 11 ++--------- 2 files changed, 7 insertions(+), 30 deletions(-) diff --git a/testing/framework/TestCmdTests.py b/testing/framework/TestCmdTests.py index e666ac4..6489095 100644 --- a/testing/framework/TestCmdTests.py +++ b/testing/framework/TestCmdTests.py @@ -2786,16 +2786,9 @@ class subdir_TestCase(TestCmdTestCase): class symlink_TestCase(TestCmdTestCase): + @unittest.skipIf(sys.platform == 'win32', "Skip symlink test on win32") def test_symlink(self): """Test symlink()""" - - #symlinks don't work well on windows - if sys.platform == 'win32': - return - - try: os.symlink - except AttributeError: return - test = TestCmd.TestCmd(workdir = '', subdir = 'foo') wdir_file1 = os.path.join(test.workdir, 'file1') wdir_target1 = os.path.join(test.workdir, 'target1') @@ -3127,17 +3120,14 @@ class workpath_TestCase(TestCmdTestCase): assert wpath == os.path.join(test.workdir, 'foo', 'bar') -@unittest.skipIf(sys.platform == 'win32', "Don't run on win32") class readable_TestCase(TestCmdTestCase): def test_readable(self): """Test readable()""" test = TestCmd.TestCmd(workdir = '', subdir = 'foo') test.write('file1', "Test file #1\n") test.write(['foo', 'file2'], "Test file #2\n") - - try: symlink = os.symlink - except AttributeError: pass - else: symlink('no_such_file', test.workpath('dangling_symlink')) + if hasattr(os, 'symlink') and sys.platform != 'win32': + symlink('no_such_file', test.workpath('dangling_symlink')) test.readable(test.workdir, 0) # XXX skip these tests if euid == 0? @@ -3175,14 +3165,8 @@ class writable_TestCase(TestCmdTestCase): test = TestCmd.TestCmd(workdir = '', subdir = 'foo') test.write('file1', "Test file #1\n") test.write(['foo', 'file2'], "Test file #2\n") - - if sys.platform != 'win32': - try: - symlink = os.symlink - except AttributeError: - pass - else: - symlink('no_such_file', test.workpath('dangling_symlink')) + if hasattr(os, 'symlink') and sys.platform != 'win32': + symlink('no_such_file', test.workpath('dangling_symlink')) test.writable(test.workdir, 0) # XXX skip these tests if euid == 0? diff --git a/testing/framework/TestCommonTests.py b/testing/framework/TestCommonTests.py index fe8d4cb..6d8c27f 100644 --- a/testing/framework/TestCommonTests.py +++ b/testing/framework/TestCommonTests.py @@ -133,7 +133,6 @@ class TestCommonTestCase(unittest.TestCase): stdout = run_env.stdout() stderr = run_env.stderr() - breakpoint() expect_stdout = expect_stdout % self.__dict__ assert stdout == expect_stdout, assert_display(expect_stdout, stdout, @@ -979,11 +978,9 @@ class must_exist_TestCase(TestCommonTestCase): stderr = run_env.stderr() assert stderr == "PASSED\n", stderr + @unittest.skipIf(sys.platform == 'win32', "Skip symlink test on win32") def test_broken_link(self) : """Test must_exist(): exists but it is a broken link""" - if sys.platform == 'win32': - return - run_env = self.run_env script = lstrip("""\ @@ -1655,13 +1652,9 @@ class must_not_exist_TestCase(TestCommonTestCase): stderr = run_env.stderr() assert stderr == "PASSED\n", stderr + @unittest.skipIf(sys.platform == 'win32', "Skip symlink test on win32") def test_existing_broken_link(self): """Test must_not_exist(): exists but it is a broken link""" - - # symlinks don't really work on win32 - if sys.platform == 'win32': - return - run_env = self.run_env script = lstrip("""\ -- cgit v0.12