summaryrefslogtreecommitdiff
path: root/test/ZIP
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins001@gmail.com>2016-09-20 23:07:51 -0400
committerWilliam Blevins <wblevins001@gmail.com>2016-09-20 23:07:51 -0400
commit3aa07da96b32d1b062ff9cc150fd662f3ef1fa2c (patch)
tree5132b0761e41f0a2c5642875806a784f4ef3a1e7 /test/ZIP
parent86c73b209b34c29ce7d1c720259cb9dea962b4f4 (diff)
downloadscons-3aa07da96b32d1b062ff9cc150fd662f3ef1fa2c.tar.gz
Fixed test/ZIP tests.
Diffstat (limited to 'test/ZIP')
-rw-r--r--test/ZIP/ZIP.py16
-rw-r--r--test/ZIP/ZIPCOM-fixture/.exclude_tests1
-rw-r--r--test/ZIP/ZIPCOM-fixture/myzip.py6
-rw-r--r--test/ZIP/ZIPCOM-fixture/test1.in2
-rw-r--r--test/ZIP/ZIPCOM.py18
-rw-r--r--test/ZIP/ZIPCOMSTR-fixture/.exclude_tests1
-rw-r--r--test/ZIP/ZIPCOMSTR-fixture/aaa.in2
-rw-r--r--test/ZIP/ZIPCOMSTR-fixture/myzip.py7
-rw-r--r--test/ZIP/ZIPCOMSTR.py16
9 files changed, 29 insertions, 40 deletions
diff --git a/test/ZIP/ZIP.py b/test/ZIP/ZIP.py
index f2acad89..f842caf9 100644
--- a/test/ZIP/ZIP.py
+++ b/test/ZIP/ZIP.py
@@ -91,7 +91,7 @@ marker_out = test.workpath('marker.out').replace('\\', '\\\\')
test.write('SConstruct', """\
def marker(target, source, env):
- open(r'%s', 'wb').write("marker\\n")
+ open(r'%s', 'wb').write(b"marker\\n")
f1 = Environment()
zipcom = f1.Dictionary('ZIPCOM')
if not isinstance(zipcom, list):
@@ -117,24 +117,24 @@ f1.Zip(target = 'f4deflated.zip', source = sources,
for f in ['file10', 'file11', 'file12',
'file13', 'file14', 'file15',
'file16', 'file17', 'file18']:
- test.write(f, f + "\n")
+ test.write(f, (f + "\n").encode())
test.run(arguments = 'f1.zip', stderr = None)
-test.fail_test(os.path.exists(test.workpath('marker.out')))
+test.must_not_exist(test.workpath('marker.out'))
-test.fail_test(not os.path.exists(test.workpath('f1.zip')))
+test.must_exist(test.workpath('f1.zip'))
test.run(arguments = 'f2.zip', stderr = None)
-test.fail_test(test.read('marker.out') != 'marker\n')
+test.must_match('marker.out', 'marker\n')
-test.fail_test(not os.path.exists(test.workpath('f2.zip')))
+test.must_exist(test.workpath('f2.zip'))
test.run(arguments = '.', stderr = None)
-test.fail_test(os.path.exists(test.workpath('f3.zip')))
-test.fail_test(not os.path.exists(test.workpath('f3.xyzzy')))
+test.must_not_exist(test.workpath('f3.zip'))
+test.must_exist(test.workpath('f3.xyzzy'))
test.fail_test(zipfile_files("f1.zip") != ['file10', 'file11', 'file12'])
diff --git a/test/ZIP/ZIPCOM-fixture/.exclude_tests b/test/ZIP/ZIPCOM-fixture/.exclude_tests
new file mode 100644
index 00000000..dae6f605
--- /dev/null
+++ b/test/ZIP/ZIPCOM-fixture/.exclude_tests
@@ -0,0 +1 @@
+myzip.py
diff --git a/test/ZIP/ZIPCOM-fixture/myzip.py b/test/ZIP/ZIPCOM-fixture/myzip.py
new file mode 100644
index 00000000..adbc6acb
--- /dev/null
+++ b/test/ZIP/ZIPCOM-fixture/myzip.py
@@ -0,0 +1,6 @@
+import sys
+outfile = open(sys.argv[1], 'wb')
+infile = open(sys.argv[2], 'rb')
+for l in [l for l in infile.readlines() if l != b'/*zip*/\n']:
+ outfile.write(l)
+sys.exit(0)
diff --git a/test/ZIP/ZIPCOM-fixture/test1.in b/test/ZIP/ZIPCOM-fixture/test1.in
new file mode 100644
index 00000000..0546626b
--- /dev/null
+++ b/test/ZIP/ZIPCOM-fixture/test1.in
@@ -0,0 +1,2 @@
+test1.in
+/*zip*/
diff --git a/test/ZIP/ZIPCOM.py b/test/ZIP/ZIPCOM.py
index e982c58c..4d84ccfe 100644
--- a/test/ZIP/ZIPCOM.py
+++ b/test/ZIP/ZIPCOM.py
@@ -34,16 +34,7 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-
-
-test.write('myzip.py', r"""
-import sys
-outfile = open(sys.argv[1], 'wb')
-infile = open(sys.argv[2], 'rb')
-for l in [l for l in infile.readlines() if l != '/*zip*/\n']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.dir_fixture('ZIPCOM-fixture')
test.write('SConstruct', """
env = Environment(TOOLS = ['zip'],
@@ -51,17 +42,10 @@ env = Environment(TOOLS = ['zip'],
env.Zip('test1.zip', 'test1.in')
""" % locals())
-test.write('test1.in', """\
-test1.in
-/*zip*/
-""")
-
test.run()
test.must_match('test1.zip', "test1.in\n")
-
-
test.pass_test()
# Local Variables:
diff --git a/test/ZIP/ZIPCOMSTR-fixture/.exclude_tests b/test/ZIP/ZIPCOMSTR-fixture/.exclude_tests
new file mode 100644
index 00000000..dae6f605
--- /dev/null
+++ b/test/ZIP/ZIPCOMSTR-fixture/.exclude_tests
@@ -0,0 +1 @@
+myzip.py
diff --git a/test/ZIP/ZIPCOMSTR-fixture/aaa.in b/test/ZIP/ZIPCOMSTR-fixture/aaa.in
new file mode 100644
index 00000000..8474a294
--- /dev/null
+++ b/test/ZIP/ZIPCOMSTR-fixture/aaa.in
@@ -0,0 +1,2 @@
+aaa.in
+/*zip*/
diff --git a/test/ZIP/ZIPCOMSTR-fixture/myzip.py b/test/ZIP/ZIPCOMSTR-fixture/myzip.py
new file mode 100644
index 00000000..f0fcc513
--- /dev/null
+++ b/test/ZIP/ZIPCOMSTR-fixture/myzip.py
@@ -0,0 +1,7 @@
+import sys
+outfile = open(sys.argv[1], 'wb')
+for f in sys.argv[2:]:
+ infile = open(f, 'rb')
+ for l in [l for l in infile.readlines() if l != b'/*zip*/\n']:
+ outfile.write(l)
+sys.exit(0)
diff --git a/test/ZIP/ZIPCOMSTR.py b/test/ZIP/ZIPCOMSTR.py
index d91a48d4..a26ed497 100644
--- a/test/ZIP/ZIPCOMSTR.py
+++ b/test/ZIP/ZIPCOMSTR.py
@@ -35,17 +35,7 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-
-
-test.write('myzip.py', """
-import sys
-outfile = open(sys.argv[1], 'wb')
-for f in sys.argv[2:]:
- infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != '/*zip*/\\n']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.dir_fixture('ZIPCOMSTR-fixture')
test.write('SConstruct', """
env = Environment(tools=['zip'],
@@ -54,16 +44,12 @@ env = Environment(tools=['zip'],
env.Zip('aaa.zip', 'aaa.in')
""" % locals())
-test.write('aaa.in', "aaa.in\n/*zip*/\n")
-
test.run(stdout = test.wrap_stdout("""\
Zipping aaa.zip from aaa.in
"""))
test.must_match('aaa.zip', "aaa.in\n")
-
-
test.pass_test()
# Local Variables: