Skip to content

Commit

Permalink
Merge branch 'test-old-packages' into '0.7.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Sep 10, 2015
2 parents 47f79db + aa03a4f commit a0b7d1f
Showing 1 changed file with 47 additions and 2 deletions.
49 changes: 47 additions & 2 deletions tests/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
import yaml

from reprounzip.unpackers.common import join_root
from reprounzip.utils import PY3, stderr_bytes, stderr

from reprounzip.utils import PY3, stderr_bytes, stderr, download_file

tests = Path(__file__).parent.absolute()

Expand Down Expand Up @@ -579,6 +578,52 @@ def check_simple(args, stream, infile=1):
raise AssertionError("Created file shouldn't be packed: %s" %
Path(f))

# ########################################
# Test old packages
#

old_packages = [
('simple-0.4.0.rpz',
'https://drive.google.com/uc?export=download&id=0B3ucPz7GSthBVG4xZW1V'
'eDhXNTQ'),
('simple-0.6.0.rpz',
'https://drive.google.com/uc?export=download&id=0B3ucPz7GSthBbl9SUjhr'
'cUdtbGs'),
('simple-0.7.1.rpz',
'https://drive.google.com/uc?export=download&id=0B3ucPz7GSthBRGp2Vm5V'
'QVpWOGs'),
]
for name, url in old_packages:
print("Testing old package %s" % name)
f = Path(name)
if not f.exists():
download_file(url, f)
# Info
check_call(rpuz + ['info', name])
# Show files
check_call(rpuz + ['showfiles', name])
# Lists packages
check_call(rpuz + ['installpkgs', '--summary', name])
# Unpack directory
check_call(rpuz + ['directory', 'setup', name, 'simpledir'])
# Run directory
check_simple(rpuz + ['directory', 'run', 'simpledir'], 'err')
output_in_dir = Path('simpledir/root/tmp')
output_in_dir = output_in_dir.listdir('reprozip_*')[0]
output_in_dir = output_in_dir / 'simple_output.txt'
with output_in_dir.open(encoding='utf-8') as fp:
assert fp.read().strip() == '42'
# Delete with wrong command (should fail)
p = subprocess.Popen(rpuz + ['chroot', 'destroy', 'simpledir'],
stderr=subprocess.PIPE)
out, err = p.communicate()
assert p.poll() != 0
err = err.splitlines()
assert b"Wrong unpacker used" in err[0]
assert err[1].startswith(b"usage: ")
# Delete directory
check_call(rpuz + ['directory', 'destroy', 'simpledir'])

# ########################################
# Copies back coverage report
#
Expand Down

0 comments on commit a0b7d1f

Please sign in to comment.