Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
next test cases
Piping test output through tee means that we have to now be careful to
catch failures in pipelines, otherwise make(1) would silently ignore a
failure of the test suite run caused by a module not being installed.
  • Loading branch information
M0ses authored and aspiers committed Apr 13, 2017
1 parent 788ce32 commit b7364bd
Show file tree
Hide file tree
Showing 43 changed files with 745 additions and 319 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -3,3 +3,6 @@ tar_scm
.*.sw?
tmp/
.coverage
htmlcov/
test*.log
cover*.log
19 changes: 18 additions & 1 deletion GNUmakefile
@@ -1,3 +1,9 @@
# Ensure that we don't accidentally ignore failing commands just
# because they're in a pipeline. This applies in particular to piping
# the test runs through tee(1).
# http://stackoverflow.com/a/31605520/179332
SHELL = /bin/bash -o pipefail

DESTDIR ?=
PREFIX = /usr/local
SYSCFG = /etc
Expand Down Expand Up @@ -41,7 +47,15 @@ pep8: tar_scm.py
.PHONY: test
test:
: Running the test suite. Please be patient - this takes a few minutes ...
PYTHONPATH=. $(PYTHON) tests/test.py
PYTHONPATH=. $(PYTHON) tests/test.py 2>&1 | tee ./test.log

test3:
: Running the test suite. Please be patient - this takes a few minutes ...
PYTHONPATH=. python3 tests/test.py 2>&1 | tee ./test3.log

cover:
PYTHONPATH=. coverage2 run tests/test.py 2>&1 | tee ./cover.log
coverage2 html --include=./TarSCM/*

tar_scm: tar_scm.py
@echo "Creating $@ which uses $(PYTHON) ..."
Expand Down Expand Up @@ -69,6 +83,9 @@ show-python:
clean:
find -name '*.pyc' -exec rm {} \;
rm -rf ./tests/tmp/
rm -f ./test.log
rm -f ./test3.log
rm -f ./cover.log
compile:
find -name '*.py' -exec python -m py_compile {} \;

42 changes: 38 additions & 4 deletions TarSCM/__init__.py
@@ -1,4 +1,38 @@
from tasks import tasks
from helpers import helpers
from cli import cli
from archive import archive
import sys
import os

from TarSCM.tasks import tasks
from TarSCM.helpers import helpers
from TarSCM.cli import cli
from TarSCM.archive import tar
from TarSCM.archive import obscpio
from TarSCM.exceptions import OptionsError

def run():
_cli = cli()
_cli.parse_args(sys.argv[1:])

if os.path.basename(sys.argv[0]) == "tar":
_cli.scm = "tar"

if os.path.basename(sys.argv[0]) == "obs_scm":
_cli.use_obs_scm = True

if os.path.basename(sys.argv[0]) == "snapcraft":
_cli.snapcraft = True

task_list = tasks()

task_list.generate_list(_cli)

try:
task_list.process_list()
except OptionsError as e:
print(e)
sys.exit(1)

task_list.finalize(_cli)

task_list.cleanup()

raise SystemExit(0)

0 comments on commit b7364bd

Please sign in to comment.