diff options
author | William Deegan <bill@baddogconsulting.com> | 2020-04-29 21:01:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 21:01:45 (GMT) |
commit | db16f4557b7c816cba466f2e009930017e4aac72 (patch) | |
tree | 82994c28520aea3112c05290aca940510b184335 | |
parent | 54352952b9cd900091d3bcc50a82028a36f184f1 (diff) | |
parent | d51ce52175bbce59b87eae7a09489f3433262f55 (diff) | |
download | SCons-db16f4557b7c816cba466f2e009930017e4aac72.zip SCons-db16f4557b7c816cba466f2e009930017e4aac72.tar.gz SCons-db16f4557b7c816cba466f2e009930017e4aac72.tar.bz2 |
Merge pull request #3632 from mwichmann/fstests-skips
tests: use unittest decorator for skipping
-rw-r--r-- | src/engine/SCons/Node/FSTests.py | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 3f2cb0e..b2014cb 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -707,26 +707,27 @@ class BaseTestCase(_tempdirTestCase): nonexistent = fs.Entry('nonexistent') assert not nonexistent.isfile() - if sys.platform != 'win32' and hasattr(os, 'symlink'): - def test_islink(self): - """Test the Base.islink() method""" - test = self.test - test.subdir('dir') - test.write("file", "file\n") - test.symlink("symlink", "symlink") - fs = SCons.Node.FS.FS() + @unittest.skipUnless(sys.platform != 'win32' and hasattr(os, 'symlink'), + "symlink is not used on Windows") + def test_islink(self): + """Test the Base.islink() method""" + test = self.test + test.subdir('dir') + test.write("file", "file\n") + test.symlink("symlink", "symlink") + fs = SCons.Node.FS.FS() - dir = fs.Entry('dir') - assert not dir.islink() + dir = fs.Entry('dir') + assert not dir.islink() - file = fs.Entry('file') - assert not file.islink() + file = fs.Entry('file') + assert not file.islink() - symlink = fs.Entry('symlink') - assert symlink.islink() + symlink = fs.Entry('symlink') + assert symlink.islink() - nonexistent = fs.Entry('nonexistent') - assert not nonexistent.islink() + nonexistent = fs.Entry('nonexistent') + assert not nonexistent.islink() class DirNodeInfoTestCase(_tempdirTestCase): @@ -1339,13 +1340,15 @@ class FSTestCase(_tempdirTestCase): # get_contents() returns the binary contents. test.write("binary_file", "Foo\x1aBar") f1 = fs.File(test.workpath("binary_file")) - assert f1.get_contents() == bytearray("Foo\x1aBar", 'utf-8'), f1.get_contents() + assert f1.get_contents() == bytearray("Foo\x1aBar", 'utf-8'), \ + f1.get_contents() # This tests to make sure we can decode UTF-8 text files. test_string = "Foo\x1aBar" test.write("utf8_file", test_string.encode('utf-8')) f1 = fs.File(test.workpath("utf8_file")) - f1.get_text_contents() == "Foo\x1aBar", f1.get_text_contents() + assert f1.get_text_contents() == "Foo\x1aBar", \ + f1.get_text_contents() # Check for string which doesn't have BOM and isn't valid # ASCII @@ -1846,10 +1849,9 @@ class FSTestCase(_tempdirTestCase): d = root._lookup_abs('/tmp/foo-nonexistent/nonexistent-dir', SCons.Node.FS.Dir) assert d.__class__ == SCons.Node.FS.Dir, str(d.__class__) + @unittest.skipUnless(sys.platform == "win32", "requires Windows") def test_lookup_uncpath(self): """Testing looking up a UNC path on Windows""" - if sys.platform not in ('win32',): - return test = self.test fs = self.fs path = '//servername/C$/foo' @@ -1859,19 +1861,17 @@ class FSTestCase(_tempdirTestCase): assert str(f) == r'\\servername\C$\foo', \ 'UNC path %s got looked up as %s' % (path, f) + @unittest.skipUnless(sys.platform.startswith == "win32", "requires Windows") def test_unc_drive_letter(self): """Test drive-letter lookup for windows UNC-style directories""" - if sys.platform not in ('win32',): - return share = self.fs.Dir(r'\\SERVER\SHARE\Directory') assert str(share) == r'\\SERVER\SHARE\Directory', str(share) + @unittest.skipUnless(sys.platform == "win32", "requires Windows") def test_UNC_dirs_2689(self): """Test some UNC dirs that printed incorrectly and/or caused infinite recursion errors prior to r5180 (SCons 2.1).""" fs = self.fs - if sys.platform not in ('win32',): - return p = fs.Dir(r"\\computername\sharename").get_abspath() assert p == r"\\computername\sharename", p p = fs.Dir(r"\\\computername\sharename").get_abspath() |