diff options
Diffstat (limited to 'test/packaging')
-rw-r--r-- | test/packaging/convenience-functions/convenience-functions.py | 2 | ||||
-rw-r--r-- | test/packaging/ipkg.py | 7 | ||||
-rw-r--r-- | test/packaging/place-files-in-subdirectory.py | 5 | ||||
-rw-r--r-- | test/packaging/rpm/internationalization.py | 22 | ||||
-rw-r--r-- | test/packaging/rpm/multipackage.py | 6 | ||||
-rw-r--r-- | test/packaging/rpm/package.py | 8 | ||||
-rw-r--r-- | test/packaging/rpm/tagging.py | 6 |
7 files changed, 36 insertions, 20 deletions
diff --git a/test/packaging/convenience-functions/convenience-functions.py b/test/packaging/convenience-functions/convenience-functions.py index a1be041..fb9acb3 100644 --- a/test/packaging/convenience-functions/convenience-functions.py +++ b/test/packaging/convenience-functions/convenience-functions.py @@ -33,7 +33,7 @@ import TestSCons test = TestSCons.TestSCons() -test.dir_fixture( "image" ) +test.dir_fixture("image") bin_f1 = os.path.join('bin', 'f1') bin_f2 = os.path.join('bin', 'f2') diff --git a/test/packaging/ipkg.py b/test/packaging/ipkg.py index 08889a9..99c31e5 100644 --- a/test/packaging/ipkg.py +++ b/test/packaging/ipkg.py @@ -73,6 +73,11 @@ Maintainer, Depends, and Description fields.''', X_IPK_DEPENDS = 'libc6, grep', ) """) +with os.popen('id -un') as p: + IPKGUSER = p.read().strip() +with os.popen('id -gn') as p: + IPKGGROUP = p.read().strip() + expected="""scons: Reading SConscript files ... scons: done reading SConscript files. scons: Building targets ... @@ -84,7 +89,7 @@ build_specfiles(["foo-0.0/CONTROL/control", "foo-0.0/CONTROL/conffiles", "foo-0. ipkg-build -o %s -g %s foo-0.0 Packaged contents of foo-0.0 into %s/foo_0.0_arm.ipk scons: done building targets. -"""%(os.popen('id -un').read().strip(), os.popen('id -gn').read().strip(), test.workpath()) +"""%(IPKGUSER, IPKGGROUP, test.workpath()) test.run(arguments="--debug=stacktrace foo_0.0_arm.ipk", stdout=expected) test.must_exist( 'foo-0.0/CONTROL/control' ) diff --git a/test/packaging/place-files-in-subdirectory.py b/test/packaging/place-files-in-subdirectory.py index 0eb791f..23ff543 100644 --- a/test/packaging/place-files-in-subdirectory.py +++ b/test/packaging/place-files-in-subdirectory.py @@ -102,8 +102,9 @@ env.Package( NAME = 'libfoo', test.run(stderr = None) -str = os.popen( 'tar -tzf %s'%test.workpath('libfoo-1.2.3.tar.gz') ).read() -test.fail_test( str != "libfoo-1.2.3/src/main.c\nlibfoo-1.2.3/SConstruct\n" ) +with os.popen('tar -tzf %s'%test.workpath('libfoo-1.2.3.tar.gz')) as p: + str = p.read() +test.fail_test(str != "libfoo-1.2.3/src/main.c\nlibfoo-1.2.3/SConstruct\n") test.pass_test() diff --git a/test/packaging/rpm/internationalization.py b/test/packaging/rpm/internationalization.py index ad77f40..eea30ca 100644 --- a/test/packaging/rpm/internationalization.py +++ b/test/packaging/rpm/internationalization.py @@ -94,25 +94,29 @@ machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine() test.must_exist( src_rpm ) test.must_exist( machine_rpm ) -test.must_not_exist( 'bin/main' ) +test.must_not_exist('bin/main') cmd = 'rpm -qp --queryformat \'%%{GROUP}-%%{SUMMARY}-%%{DESCRIPTION}\' %s' os.environ['LANGUAGE'] = 'de' -out = os.popen( cmd % test.workpath(machine_rpm) ).read() -test.fail_test( out != 'Applikation/büro-hallo-das sollte wirklich lang sein' ) +with os.popen(cmd % test.workpath(machine_rpm)) as p: + out = p.read() +test.fail_test(out != 'Applikation/büro-hallo-das sollte wirklich lang sein') os.environ['LANGUAGE'] = 'fr' -out = os.popen( cmd % test.workpath(machine_rpm) ).read() -test.fail_test( out != 'Application/bureau-bonjour-ceci devrait être vraiment long' ) +with os.popen(cmd % test.workpath(machine_rpm)) as p: + out = p.read() +test.fail_test(out != 'Application/bureau-bonjour-ceci devrait être vraiment long') os.environ['LANGUAGE'] = 'en' -out = os.popen( cmd % test.workpath(machine_rpm) ).read() -test.fail_test( out != 'Application/office-hello-this should be really long' ) +with os.popen(cmd % test.workpath(machine_rpm)) as p: + out = p.read() +test.fail_test(out != 'Application/office-hello-this should be really long') os.environ['LC_ALL'] = 'ae' -out = os.popen( cmd % test.workpath(machine_rpm) ).read() -test.fail_test( out != 'Application/office-hello-this should be really long' ) +with os.popen(cmd % test.workpath(machine_rpm)) as p: + out = p.read() +test.fail_test(out != 'Application/office-hello-this should be really long') # # test INTERNATIONAL PACKAGE TAGS diff --git a/test/packaging/rpm/multipackage.py b/test/packaging/rpm/multipackage.py index fd67a09..2f106f4 100644 --- a/test/packaging/rpm/multipackage.py +++ b/test/packaging/rpm/multipackage.py @@ -104,9 +104,11 @@ test.must_exist( machine_rpm2 ) test.must_exist( src_rpm2 ) test.must_not_exist( 'bin/main' ) -out = os.popen( 'rpm -qpl %s' % machine_rpm).read() +with os.popen('rpm -qpl %s' % machine_rpm) as p: + out = p.read() test.must_contain_all_lines( out, '/bin/main') -out = os.popen( 'rpm -qpl %s' % src_rpm).read() +with os.popen('rpm -qpl %s' % src_rpm) as p: + out = p.read() test.fail_test( not out == 'foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n') test.pass_test() diff --git a/test/packaging/rpm/package.py b/test/packaging/rpm/package.py index 2ba66b9..ddd3c89 100644 --- a/test/packaging/rpm/package.py +++ b/test/packaging/rpm/package.py @@ -83,9 +83,11 @@ machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine() test.must_exist( machine_rpm ) test.must_exist( src_rpm ) test.must_not_exist( 'bin/main' ) -out = os.popen( 'rpm -qpl %s' % machine_rpm).read() -test.must_contain_all_lines( out, '/bin/main') -out = os.popen( 'rpm -qpl %s' % src_rpm).read() +with os.popen('rpm -qpl %s' % machine_rpm) as p: + out = p.read() +test.must_contain_all_lines(out, '/bin/main') +with os.popen('rpm -qpl %s' % machine_rpm) as p: + out = p.read() test.fail_test( not out == 'foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n') test.pass_test() diff --git a/test/packaging/rpm/tagging.py b/test/packaging/rpm/tagging.py index b685c91..c730e14 100644 --- a/test/packaging/rpm/tagging.py +++ b/test/packaging/rpm/tagging.py @@ -85,11 +85,13 @@ src_rpm = 'foo-1.2.3-0.src.rpm' machine_rpm = 'foo-1.2.3-0.%s.rpm' % SCons.Tool.rpmutils.defaultMachine() test.must_exist( machine_rpm ) -out = os.popen('rpm -qpl %s' % machine_rpm).read() +with os.popen('rpm -qpl %s' % machine_rpm) as p: + out = p.read() test.must_contain_all_lines( out, '/bin/main') test.must_exist( src_rpm ) -out = os.popen('rpm -qpl %s' % src_rpm).read() +with os.popen('rpm -qpl %s' % src_rpm) as p: + out = p.read() test.fail_test( not out == 'foo-1.2.3.spec\nfoo-1.2.3.tar.gz\n') expect = '(0755, root, users) /bin/main' |