From e8e8d71df80b9b690ef9f2d5b83378f23677e30f Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 7 Feb 2020 11:52:53 -0700 Subject: Stop calling os.system in tests. This converts the remaining tests that called os.system themselves to use subprocess instead. Signed-off-by: Mats Wichmann --- test/AS/as-live.py | 4 ++-- test/Actions/actions.py | 10 ++++++---- test/CC/CCVERSION-fixture/versioned.py | 4 ++-- test/CXX/CXXVERSION.py | 8 +++----- test/DVIPDF/DVIPDF.py | 5 +++-- test/DVIPDF/DVIPDFFLAGS.py | 5 +++-- test/DVIPS/DVIPS.py | 4 ++-- test/DVIPS/DVIPSFLAGS.py | 7 ++++--- test/Ghostscript/GS.py | 5 ++--- test/LINK/LINKFLAGS.py | 6 +++--- test/LINK/SHLINKFLAGS.py | 6 +++--- test/SPAWN.py | 8 +++++--- test/TEX/biber_biblatex.py | 7 ++++--- test/TEX/biber_biblatex2.py | 7 ++++--- test/TEX/biblatex.py | 7 ++++--- test/TEX/biblatex_plain.py | 7 ++++--- test/TEX/clean.py | 7 ++++--- test/TEX/glossaries.py | 7 ++++--- test/TEX/glossary.py | 7 ++++--- test/TEX/lstinputlisting.py | 7 ++++--- test/TEX/multibib.py | 7 ++++--- test/TEX/newglossary.py | 7 ++++--- test/TEX/nomencl.py | 7 ++++--- test/TEX/recursive_scanner_dependencies_import.py | 7 ++++--- test/TEX/variant_dir_bibunit.py | 7 ++++--- test/TEX/variant_dir_newglossary.py | 7 ++++--- test/packaging/use-builddir.py | 15 ++++++--------- 27 files changed, 100 insertions(+), 85 deletions(-) diff --git a/test/AS/as-live.py b/test/AS/as-live.py index b781caf..676b537 100644 --- a/test/AS/as-live.py +++ b/test/AS/as-live.py @@ -56,12 +56,12 @@ if sys.platform == "win32": testccc = "" test.write("wrapper.py", """\ -import os +import subprocess import sys with open('%s', 'wb') as f: f.write(("wrapper.py: %%s\\n" %% sys.argv[-1]).encode()) cmd = " ".join(sys.argv[1:]) -os.system(cmd) +subprocess.run(cmd, shell=True) """ % test.workpath('wrapper.out').replace('\\', '\\\\')) test.write('SConstruct', """\ diff --git a/test/Actions/actions.py b/test/Actions/actions.py index f1bb6fe..cf5890d 100644 --- a/test/Actions/actions.py +++ b/test/Actions/actions.py @@ -65,12 +65,13 @@ test.must_match('foo.out', '2\nfoo.in\n') test.up_to_date(arguments = '.') test.write('SConstruct', """ -import os +import subprocess def func(env, target, source): cmd = r'%(_python_)s build.py %%s 3 %%s' %% (' '.join(map(str, target)), ' '.join(map(str, source))) print(cmd) - return os.system(cmd) + cp = subprocess.run(cmd, shell=True) + return cp.returncode B = Builder(action = func) env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'foo.out', source = 'foo.in') @@ -83,7 +84,7 @@ test.must_match('foo.out', '3\nfoo.in\n') test.up_to_date(arguments = '.') test.write('SConstruct', """ -import os +import subprocess assert 'string' not in globals() class bld(object): def __init__(self): @@ -91,7 +92,8 @@ class bld(object): def __call__(self, env, target, source): cmd = self.get_contents(env, target, source) print(cmd) - return os.system(cmd) + cp = subprocess.run(cmd, shell=True) + return cp.returncode def get_contents(self, env, target, source): return self.cmd %% (' '.join(map(str, target)), ' '.join(map(str, source))) diff --git a/test/CC/CCVERSION-fixture/versioned.py b/test/CC/CCVERSION-fixture/versioned.py index d6c7ae8..33dc574 100644 --- a/test/CC/CCVERSION-fixture/versioned.py +++ b/test/CC/CCVERSION-fixture/versioned.py @@ -1,4 +1,4 @@ -import os +import subprocess import sys if '-dumpversion' in sys.argv: print('3.9.9') @@ -9,4 +9,4 @@ if '--version' in sys.argv: if sys.argv[1] not in [ '2.9.9', '3.9.9' ]: print('wrong version', sys.argv[1], 'when wrapping', sys.argv[2]) sys.exit(1) -os.system(" ".join(sys.argv[2:])) +subprocess.run(" ".join(sys.argv[2:]), shell=True) diff --git a/test/CXX/CXXVERSION.py b/test/CXX/CXXVERSION.py index abe6ce0..50ff8f8 100644 --- a/test/CXX/CXXVERSION.py +++ b/test/CXX/CXXVERSION.py @@ -24,7 +24,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os import sys import TestSCons @@ -37,9 +36,8 @@ if sys.platform == 'win32': test.skip_test('CXXVERSION not set with MSVC, skipping test.') -test.write("versioned.py", -"""from __future__ import print_function -import os +test.write("versioned.py", """\ +import subprocess import sys if '-dumpversion' in sys.argv: print('3.9.9') @@ -50,7 +48,7 @@ if '--version' in sys.argv: if sys.argv[1] not in [ '2.9.9', '3.9.9' ]: print('wrong version', sys.argv[1], 'when wrapping', sys.argv[2]) sys.exit(1) -os.system(" ".join(sys.argv[2:])) +subprocess.run(" ".join(sys.argv[2:]), shell=True) """) test.write('SConstruct', """ diff --git a/test/DVIPDF/DVIPDF.py b/test/DVIPDF/DVIPDF.py index 87f4012..1c017a9 100644 --- a/test/DVIPDF/DVIPDF.py +++ b/test/DVIPDF/DVIPDF.py @@ -107,11 +107,12 @@ tex = test.where_is('tex') if dvipdf and tex: - test.write("wrapper.py", """import os + test.write("wrapper.py", """\ +import subprocess import sys cmd = " ".join(sys.argv[1:]) open('%s', 'a').write("%%s\\n" %% cmd) -os.system(cmd) +subprocess.run(cmd, shell=True) """ % test.workpath('wrapper.out').replace('\\', '\\\\')) test.write('SConstruct', """ diff --git a/test/DVIPDF/DVIPDFFLAGS.py b/test/DVIPDF/DVIPDFFLAGS.py index 30d0e4f..9ecb736 100644 --- a/test/DVIPDF/DVIPDFFLAGS.py +++ b/test/DVIPDF/DVIPDFFLAGS.py @@ -111,11 +111,12 @@ tex = test.where_is('tex') if dvipdf and tex: - test.write("wrapper.py", """import os + test.write("wrapper.py", """\ +import subprocess import sys cmd = " ".join(sys.argv[1:]) open('%s', 'a').write("%%s\\n" %% cmd) -os.system(cmd) +subprocess.run(cmd, shell=True) """ % test.workpath('wrapper.out').replace('\\', '\\\\')) test.write('SConstruct', """ diff --git a/test/DVIPS/DVIPS.py b/test/DVIPS/DVIPS.py index df7811a..3cfd730 100644 --- a/test/DVIPS/DVIPS.py +++ b/test/DVIPS/DVIPS.py @@ -123,11 +123,11 @@ if not dvips: test.skip_test("Could not find 'dvips'; skipping test(s).\n") test.write("wrapper.py", """ -import os +import subprocess import sys cmd = " ".join(sys.argv[1:]) open('%s', 'a').write("%%s\\n" %% cmd) -os.system(cmd) +subprocess.run(cmd, shell=True) """ % test.workpath('wrapper.out').replace('\\', '\\\\')) test.write('SConstruct', """ diff --git a/test/DVIPS/DVIPSFLAGS.py b/test/DVIPS/DVIPSFLAGS.py index b6625d7..f2e6ba9 100644 --- a/test/DVIPS/DVIPSFLAGS.py +++ b/test/DVIPS/DVIPSFLAGS.py @@ -126,11 +126,12 @@ dvips = test.where_is('dvips') if dvips: test.write("wrapper.py", """ -import os +import subprocess import sys cmd = " ".join(sys.argv[1:]) -open('%s', 'a').write("%%s\\n" %% cmd) -os.system(cmd) +with open('%s', 'a') as f: + f.write("%%s\\n" %% cmd) +subprocess.run(cmd, shell=True) """ % test.workpath('wrapper.out').replace('\\', '\\\\')) test.write('SConstruct', """ diff --git a/test/Ghostscript/GS.py b/test/Ghostscript/GS.py index 3f5aa58..68f7427 100644 --- a/test/Ghostscript/GS.py +++ b/test/Ghostscript/GS.py @@ -74,13 +74,12 @@ else: gs = test.where_is(gs_executable) if gs: - test.write("wrapper.py", """\ -import os +import subprocess import sys cmd = " ".join(sys.argv[1:]) open('%s', 'a').write("%%s\\n" %% cmd) -os.system(cmd) +subprocess.run(cmd, shell=True) """ % test.workpath('wrapper.out').replace('\\', '\\\\')) test.write('SConstruct', """\ diff --git a/test/LINK/LINKFLAGS.py b/test/LINK/LINKFLAGS.py index 1642459..749e369 100644 --- a/test/LINK/LINKFLAGS.py +++ b/test/LINK/LINKFLAGS.py @@ -33,13 +33,13 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() -test.write("wrapper.py", -"""import os +test.write("wrapper.py", """\ +import subprocess import sys with open('%s', 'wb') as f: f.write(("wrapper.py\\n").encode()) args = [s for s in sys.argv[1:] if s != 'fake_link_flag'] -os.system(" ".join(args)) +subprocess.run(" ".join(args), shell=True) """ % test.workpath('wrapper.out').replace('\\', '\\\\')) test.write('SConstruct', """ diff --git a/test/LINK/SHLINKFLAGS.py b/test/LINK/SHLINKFLAGS.py index ab90ece..af5bdbb 100644 --- a/test/LINK/SHLINKFLAGS.py +++ b/test/LINK/SHLINKFLAGS.py @@ -34,13 +34,13 @@ _shlib = TestSCons._dll test = TestSCons.TestSCons() -test.write("wrapper.py", -"""import os +test.write("wrapper.py", """ +import subprocess import sys with open('%s', 'wb') as f: f.write(("wrapper.py\\n").encode()) args = [s for s in sys.argv[1:] if s != 'fake_shlink_flag'] -os.system(" ".join(args)) +subprocess.run(" ".join(args), shell=True) """ % test.workpath('wrapper.out').replace('\\', '\\\\')) test.write('SConstruct', """ diff --git a/test/SPAWN.py b/test/SPAWN.py index fba21d5..1949eb6 100644 --- a/test/SPAWN.py +++ b/test/SPAWN.py @@ -43,18 +43,20 @@ with open(sys.argv[1], 'wb') as ofp: """) test.write('SConstruct', """ -import os +import subprocess import sys def my_spawn1(sh, escape, cmd, args, env): s = " ".join(args + ['extra1.txt']) if sys.platform in ['win32']: s = '"' + s + '"' - os.system(s) + cp = subprocess.run(s, shell=True) + return cp.returncode def my_spawn2(sh, escape, cmd, args, env): s = " ".join(args + ['extra2.txt']) if sys.platform in ['win32']: s = '"' + s + '"' - os.system(s) + cp = subprocess.run(s, shell=True) + return cp.returncode env = Environment(MY_SPAWN1 = my_spawn1, MY_SPAWN2 = my_spawn2, COMMAND = r'%(_python_)s cat.py $TARGET $SOURCES') diff --git a/test/TEX/biber_biblatex.py b/test/TEX/biber_biblatex.py index 6ee8121..10c75af 100755 --- a/test/TEX/biber_biblatex.py +++ b/test/TEX/biber_biblatex.py @@ -30,8 +30,9 @@ Test creation of a Tex document that uses the multibib oackage Test courtesy Rob Managan. """ +import subprocess + import TestSCons -import os test = TestSCons.TestSCons() @@ -43,8 +44,8 @@ biber = test.where_is('biber') if not biber: test.skip_test("Could not find 'biber'; skipping test.\n") -gloss = os.system('kpsewhich biblatex.sty') -if not gloss==0: +cp = subprocess.run('kpsewhich biblatex.sty', shell=True) +if cp.returncode: test.skip_test("biblatex.sty not installed; skipping test(s).\n") diff --git a/test/TEX/biber_biblatex2.py b/test/TEX/biber_biblatex2.py index 61fafcf..92c7ea9 100644 --- a/test/TEX/biber_biblatex2.py +++ b/test/TEX/biber_biblatex2.py @@ -32,8 +32,9 @@ Require both be installed Test courtesy Rob Managan. """ +import subprocess + import TestSCons -import os test = TestSCons.TestSCons() @@ -49,8 +50,8 @@ bibtex = test.where_is('bibtex') if not bibtex: test.skip_test("Could not find 'bibtex'; skipping test.\n") -biblatex = os.system('kpsewhich biblatex.sty') -if not biblatex==0: +cp = subprocess.run('kpsewhich biblatex.sty', shell=True) +if cp.returncode: test.skip_test("biblatex.sty not installed; skipping test(s).\n") diff --git a/test/TEX/biblatex.py b/test/TEX/biblatex.py index bb88aaa..1e605cf 100755 --- a/test/TEX/biblatex.py +++ b/test/TEX/biblatex.py @@ -30,8 +30,9 @@ Test creation of a Tex document that uses the biblatex package Test courtesy Rob Managan. """ +import subprocess + import TestSCons -import os test = TestSCons.TestSCons() @@ -39,8 +40,8 @@ latex = test.where_is('pdflatex') if not latex: test.skip_test("Could not find 'pdflatex'; skipping test.\n") -biblatex = os.system('kpsewhich biblatex.sty') -if not biblatex==0: +cp = subprocess.run('kpsewhich biblatex.sty', shell=True) +if cp.returncode: test.skip_test("biblatex.sty not installed; skipping test(s).\n") diff --git a/test/TEX/biblatex_plain.py b/test/TEX/biblatex_plain.py index 5cad924..0fe15f8 100644 --- a/test/TEX/biblatex_plain.py +++ b/test/TEX/biblatex_plain.py @@ -30,8 +30,9 @@ Test creation of a Tex document that uses the biblatex package Test courtesy Rob Managan. """ +import subprocess + import TestSCons -import os test = TestSCons.TestSCons() @@ -39,8 +40,8 @@ latex = test.where_is('pdflatex') if not latex: test.skip_test("Could not find 'pdflatex'; skipping test.\n") -biblatex = os.system('kpsewhich biblatex.sty') -if not biblatex==0: +cp = subprocess.run('kpsewhich biblatex.sty', shell=True) +if cp.returncode: test.skip_test("biblatex.sty not installed; skipping test(s).\n") diff --git a/test/TEX/clean.py b/test/TEX/clean.py index 781caa1..4cae61d 100644 --- a/test/TEX/clean.py +++ b/test/TEX/clean.py @@ -28,7 +28,8 @@ r""" Check that all auxilary files created by LaTeX are properly cleaned by scons -c. """ -import os +import subprocess + import TestSCons test = TestSCons.TestSCons() @@ -38,8 +39,8 @@ latex = test.where_is('latex') if not latex: test.skip_test("Could not find 'latex'; skipping test(s).\n") -comment = os.system('kpsewhich comment.sty') -if not comment==0: +cp = subprocess.run('kpsewhich comment.sty', shell=True) +if cp.returncode: test.skip_test("comment.sty not installed; skipping test(s).\n") # package hyperref generates foo.out diff --git a/test/TEX/glossaries.py b/test/TEX/glossaries.py index cbb6964..a9fd1dc 100644 --- a/test/TEX/glossaries.py +++ b/test/TEX/glossaries.py @@ -31,7 +31,8 @@ be aware of the necessary created glossary files. Test configuration contributed by Robert Managan. """ -import os +import subprocess + import TestSCons test = TestSCons.TestSCons() @@ -41,8 +42,8 @@ latex = test.where_is('latex') if not latex: test.skip_test("Could not find 'latex'; skipping test(s).\n") -gloss = os.system('kpsewhich glossaries.sty') -if not gloss==0: +cp = subprocess.run('kpsewhich glossaries.sty', shell=True) +if cp.returncode: test.skip_test("glossaries.sty not installed; skipping test(s).\n") test.write('SConstruct', """\ diff --git a/test/TEX/glossary.py b/test/TEX/glossary.py index ef13ca1..d4ab579 100644 --- a/test/TEX/glossary.py +++ b/test/TEX/glossary.py @@ -31,7 +31,8 @@ be aware of the necessary created glossary files. Test configuration contributed by Robert Managan. """ -import os +import subprocess + import TestSCons test = TestSCons.TestSCons() @@ -41,8 +42,8 @@ latex = test.where_is('latex') if not latex: test.skip_test("Could not find 'latex'; skipping test(s).\n") -gloss = os.system('kpsewhich glossary.sty') -if not gloss==0: +cp = subprocess.run('kpsewhich glossary.sty', shell=True) +if cp.returncode: test.skip_test("glossary.sty not installed; skipping test(s).\n") test.write('SConstruct', """\ diff --git a/test/TEX/lstinputlisting.py b/test/TEX/lstinputlisting.py index 1f5020b..40f935b 100644 --- a/test/TEX/lstinputlisting.py +++ b/test/TEX/lstinputlisting.py @@ -31,8 +31,9 @@ changes. Thanks to Stefan Hepp for the patch that fixed this. """ +import subprocess + import TestSCons -import os test = TestSCons.TestSCons() @@ -41,8 +42,8 @@ pdflatex = test.where_is('pdflatex') if not pdflatex: test.skip_test("Could not find 'pdflatex'; skipping test(s).\n") -listings = os.system('kpsewhich listings.sty') -if not listings==0: +cp = subprocess.run('kpsewhich listings.sty', shell=True) +if cp.returncode: test.skip_test("listings.sty not installed; skipping test(s).\n") test.write(['SConstruct'], """\ diff --git a/test/TEX/multibib.py b/test/TEX/multibib.py index 114ade6..f80384a 100644 --- a/test/TEX/multibib.py +++ b/test/TEX/multibib.py @@ -30,8 +30,9 @@ Test creation of a Tex document that uses the multibib oackage Test courtesy Rob Managan. """ +import subprocess + import TestSCons -import os test = TestSCons.TestSCons() @@ -39,8 +40,8 @@ latex = test.where_is('latex') if not latex: test.skip_test("Could not find 'latex'; skipping test.\n") -multibib = os.system('kpsewhich multibib.sty') -if not multibib==0: +cp = subprocess.run('kpsewhich multibib.sty', shell=True) +if cp.returncode: test.skip_test("multibib.sty not installed; skipping test(s).\n") test.subdir(['src']) diff --git a/test/TEX/newglossary.py b/test/TEX/newglossary.py index 5d868a8..70296cf 100644 --- a/test/TEX/newglossary.py +++ b/test/TEX/newglossary.py @@ -31,7 +31,8 @@ be aware of the necessary created glossary files. Test configuration contributed by Robert Managan. """ -import os +import subprocess + import TestSCons test = TestSCons.TestSCons() @@ -41,8 +42,8 @@ latex = test.where_is('latex') if not latex: test.skip_test("Could not find 'latex'; skipping test(s).\n") -gloss = os.system('kpsewhich glossaries.sty') -if not gloss==0: +cp = subprocess.run('kpsewhich glossaries.sty', shell=True) +if cp.returncode: test.skip_test("glossaries.sty not installed; skipping test(s).\n") test.write('SConstruct', """\ diff --git a/test/TEX/nomencl.py b/test/TEX/nomencl.py index 0eb0b84..9cbced7 100644 --- a/test/TEX/nomencl.py +++ b/test/TEX/nomencl.py @@ -31,7 +31,8 @@ be aware of the necessary created glossary files. Test configuration contributed by Robert Managan. """ -import os +import subprocess + import TestSCons test = TestSCons.TestSCons() @@ -41,8 +42,8 @@ latex = test.where_is('latex') if not latex: test.skip_test("Could not find 'latex'; skipping test(s).\n") -nomencl = os.system('kpsewhich nomencl.sty') -if not nomencl==0: +cp = subprocess.run('kpsewhich nomencl.sty', shell=True) +if cp.returncode: test.skip_test("nomencl.sty not installed; skipping test(s).\n") test.write('SConstruct', """\ diff --git a/test/TEX/recursive_scanner_dependencies_import.py b/test/TEX/recursive_scanner_dependencies_import.py index a7b5e4a..7b6cb65 100644 --- a/test/TEX/recursive_scanner_dependencies_import.py +++ b/test/TEX/recursive_scanner_dependencies_import.py @@ -34,7 +34,8 @@ recursive_scanner_dependencies_input.py test because \input and dependencies are found only by the scanner. """ -import os +import subprocess + import TestSCons test = TestSCons.TestSCons() @@ -44,8 +45,8 @@ pdflatex = test.where_is('pdflatex') if not pdflatex: test.skip_test("Could not find 'pdflatex'; skipping test(s).\n") -latex_import = os.system('kpsewhich import.sty') -if latex_import != 0: +cp = subprocess.run('kpsewhich import.sty', shell=True) +if cp.returncode: test.skip_test("import.sty not installed; skipping test(s).\n") test.subdir('subdir') diff --git a/test/TEX/variant_dir_bibunit.py b/test/TEX/variant_dir_bibunit.py index e127a76..2a669ba 100644 --- a/test/TEX/variant_dir_bibunit.py +++ b/test/TEX/variant_dir_bibunit.py @@ -34,8 +34,9 @@ Latex produces by default. Test courtesy Rob Managan. """ +import subprocess + import TestSCons -import os test = TestSCons.TestSCons() @@ -44,8 +45,8 @@ bibtex = test.where_is('bibtex') if not all((latex, bibtex)): test.skip_test("Could not find 'latex' and/or 'bibtex'; skipping test.\n") -bibunits = os.system('kpsewhich bibunits.sty') -if not bibunits==0: +cp = subprocess.run('kpsewhich bibunits.sty', shell=True) +if cp.returncode: test.skip_test("bibunits.sty not installed; skipping test(s).\n") test.subdir(['src']) diff --git a/test/TEX/variant_dir_newglossary.py b/test/TEX/variant_dir_newglossary.py index 5e4d10d..ae865aa 100644 --- a/test/TEX/variant_dir_newglossary.py +++ b/test/TEX/variant_dir_newglossary.py @@ -31,7 +31,8 @@ with variant_dir. Test configuration contributed by Kendrick Boyd. """ -import os +import subprocess + import TestSCons test = TestSCons.TestSCons() @@ -41,8 +42,8 @@ latex = test.where_is('latex') if not latex: test.skip_test("Could not find 'latex'; skipping test(s).\n") -gloss = os.system('kpsewhich glossaries.sty') -if gloss!=0: +cp = subprocess.run('kpsewhich glossaries.sty', shell=True) +if cp.returncode: test.skip_test("glossaries.sty not installed; skipping test(s).\n") diff --git a/test/packaging/use-builddir.py b/test/packaging/use-builddir.py index 2395a8e..86a8219 100644 --- a/test/packaging/use-builddir.py +++ b/test/packaging/use-builddir.py @@ -28,13 +28,13 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" Test the ability to use the archiver in combination with builddir. """ -import os +import subprocess + import TestSCons python = TestSCons.python test = TestSCons.TestSCons() -test.verbose_set(3) tar = test.detect("TAR", "tar") if not tar: @@ -48,9 +48,7 @@ test.subdir("build") test.write("src/main.c", "") -test.write( - "SConstruct", - """ +test.write("SConstruct", """\ VariantDir('build', 'src') DefaultEnvironment(tools=[]) env=Environment(tools=['packaging', 'filesystem', 'zip']) @@ -76,9 +74,7 @@ test.subdir("temp") test.write("src/main.c", "") -test.write( - "SConstruct", - """ +test.write("SConstruct", """\ DefaultEnvironment(tools=[]) VariantDir('build', 'src') env=Environment(tools=['packaging', 'filesystem', 'tar']) @@ -93,7 +89,8 @@ test.run(stderr=None) test.must_exist("libfoo-1.2.3.tar.gz") -os.system('%s -C temp -xzf %s'%(tar, test.workpath('libfoo-1.2.3.tar.gz') )) +testdir = test.workpath('libfoo-1.2.3.tar.gz') +subprocess.run('%s -C temp -xzf %s' % (tar, testdir), shell=True) test.must_exist("temp/libfoo-1.2.3/src/main.c") test.must_exist("temp/libfoo-1.2.3/SConstruct") -- cgit v0.12 From 14fb32fe61d4cdb15f7ae699b55eaf60bc18ff5b Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Fri, 7 Feb 2020 14:35:23 -0700 Subject: Fix a couple of tests After a change to the tool itself, the update-release-info test needed an update to match. This doesn't seem to be sufficient yet. The SPAWN test was updated for this PR, but broke on Windows because apparently too much quoting for calling via subprocess. Dropped the special-case windows quoting in the test itself. Signed-off-by: Mats Wichmann --- test/SPAWN.py | 7 +++---- test/update-release-info/update-release-info.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/test/SPAWN.py b/test/SPAWN.py index 1949eb6..ca9d344 100644 --- a/test/SPAWN.py +++ b/test/SPAWN.py @@ -45,18 +45,17 @@ with open(sys.argv[1], 'wb') as ofp: test.write('SConstruct', """ import subprocess import sys + def my_spawn1(sh, escape, cmd, args, env): s = " ".join(args + ['extra1.txt']) - if sys.platform in ['win32']: - s = '"' + s + '"' cp = subprocess.run(s, shell=True) return cp.returncode + def my_spawn2(sh, escape, cmd, args, env): s = " ".join(args + ['extra2.txt']) - if sys.platform in ['win32']: - s = '"' + s + '"' cp = subprocess.run(s, shell=True) return cp.returncode + env = Environment(MY_SPAWN1 = my_spawn1, MY_SPAWN2 = my_spawn2, COMMAND = r'%(_python_)s cat.py $TARGET $SOURCES') diff --git a/test/update-release-info/update-release-info.py b/test/update-release-info/update-release-info.py index d0242a8..0a7f08f 100644 --- a/test/update-release-info/update-release-info.py +++ b/test/update-release-info/update-release-info.py @@ -110,7 +110,7 @@ combo_fail(0, 2) combo_fail(1, 2) combo_fail(0, 1, 2, stdout = """ERROR: `bad' is not a valid release type in version tuple; -\tit must be one of alpha, beta, candidate, or final +\tit must be one of dev, beta, candidate, or final """) # We won't need this entry again, so put in a default -- cgit v0.12