diff options
author | William Deegan <bill@baddogconsulting.com> | 2020-06-15 22:39:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 22:39:09 (GMT) |
commit | 1ab90a5d7d50da39e82ba1ad2b5cce5995ef2a11 (patch) | |
tree | f5a864e888796e535e617ac8c0869c227abd964a /test | |
parent | bb795ab3b64f9c0b9309d153a8effd146dfd7ce0 (diff) | |
parent | af2e24f7e4d3cd1edc309838d17988b3752d7657 (diff) | |
download | SCons-1ab90a5d7d50da39e82ba1ad2b5cce5995ef2a11.zip SCons-1ab90a5d7d50da39e82ba1ad2b5cce5995ef2a11.tar.gz SCons-1ab90a5d7d50da39e82ba1ad2b5cce5995ef2a11.tar.bz2 |
Merge pull request #3696 from mwichmann/test-cleanup
Cleanups in tests and in framework
Diffstat (limited to 'test')
-rw-r--r-- | test/SConscript/SConscript.py | 5 | ||||
-rw-r--r-- | test/option/option_profile.py | 13 | ||||
-rw-r--r-- | test/redirection.py | 14 |
3 files changed, 5 insertions, 27 deletions
diff --git a/test/SConscript/SConscript.py b/test/SConscript/SConscript.py index fd8511d..a9ede48 100644 --- a/test/SConscript/SConscript.py +++ b/test/SConscript/SConscript.py @@ -34,6 +34,7 @@ test.write('foo.py', "foo = 4\n") test.write('SConstruct', """\ import os import foo +from collections import UserList assert foo.foo == 4 @@ -71,10 +72,6 @@ assert foo == "subdir/SConscript foo" SConscript('SConscript5') -try: - from collections import UserList -except ImportError: - from UserList import UserList x7 = "SConstruct x7" x8 = "SConstruct x8" x9 = SConscript('SConscript6', UserList(["x7", "x8"])) diff --git a/test/option/option_profile.py b/test/option/option_profile.py index c252b39..8c7d80a 100644 --- a/test/option/option_profile.py +++ b/test/option/option_profile.py @@ -24,18 +24,9 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import sys - -# TODO: Fixup StringIO usage when Py2.7 is dropped. -# cheat a little bit: io.StringIO is "preferred" in Py2.7 -# since it forces you to be explicit about strings (it is unicode-only) -# It's easier to use the unaware version. Which also doesn't come -# with a context manager, so use contextlib.closing -try: - from cStringIO import StringIO -except ImportError: - from io import StringIO import contextlib +import sys +from io import StringIO import TestSCons diff --git a/test/redirection.py b/test/redirection.py index 0960dfd..f30a2e3 100644 --- a/test/redirection.py +++ b/test/redirection.py @@ -32,7 +32,6 @@ test = TestSCons.TestSCons() test.write('cat.py', r""" import sys -PY3K = sys.version_info >= (3, 0) # write binary to stdout if sys.platform == "win32": @@ -40,22 +39,13 @@ if sys.platform == "win32": msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) - try: with open(sys.argv[1], 'rb') as f: indata = f.read() except IndexError: - if PY3K: - source = sys.stdin.buffer - else: - source = sys.stdin - indata = source.read() + indata = sys.stdin.buffer.read() -if PY3K: - sys.stdout.buffer.write(indata) -else: - sys.stdout.write(indata) - +sys.stdout.buffer.write(indata) sys.exit(0) """) |