Skip to content

Commit 01baa72

Browse files
authored
Merge pull request #55 from common-workflow-language/release-refresh
Release refresh
2 parents f3a4276 + 7a3fefe commit 01baa72

File tree

8 files changed

+57
-30
lines changed

8 files changed

+57
-30
lines changed

MANIFEST.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
include Makefile
1+
include Makefile gittaggers.py
2+
include tests/*
3+
include tests/test-data/*
24
global-exclude *~
35
global-exclude *.pyc
6+

Makefile

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ MODULE=cwltest
2626
# `SHELL=bash` doesn't work for some, so don't use BASH-isms like
2727
# `[[` conditional expressions.
2828
PYSOURCES=$(wildcard ${MODULE}/**.py tests/*.py) setup.py
29-
DEVPKGS=pep8 diff_cover autopep8 pylint coverage pep257 flake8
29+
DEVPKGS=pep8 diff_cover autopep8 pylint coverage pep257 flake8 pytest
3030
DEBDEVPKGS=pep8 python-autopep8 pylint python-coverage pep257 sloccount python-flake8
3131
VERSION=1.0.$(shell date +%Y%m%d%H%M%S --date=`git log --first-parent \
3232
--max-count=1 --format=format:%cI`)
3333
mkfile_dir := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
3434

3535
## all : default task
3636
all:
37-
./setup.py develop
37+
pip install -e .
3838

3939
## help : print this help message and exit
4040
help: Makefile
@@ -109,10 +109,7 @@ diff_pylint_report: pylint_report.txt
109109
diff-quality --violations=pylint pylint_report.txt
110110

111111
.coverage: $(PYSOURCES) all
112-
export COVERAGE_PROCESS_START=${mkfile_dir}.coveragerc; \
113-
cd ${CWL}; ./run_test.sh RUNNER=cwltool
114-
coverage run setup.py test
115-
coverage combine ${CWL} ${CWL}/draft-3/ ./
112+
coverage run ./setup.py test
116113

117114
coverage.xml: .coverage
118115
python-coverage xml
@@ -135,6 +132,7 @@ diff-cover.html: coverage-gcovr.xml coverage.xml
135132

136133
## test : run the ${MODULE} test suite
137134
test: FORCE
135+
./setup.py test
138136

139137
sloccount.sc: ${PYSOURCES} Makefile
140138
sloccount --duplicates --wide --details $^ > sloccount.sc

release-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set -x
66
package=cwltest
77
module=cwltest
88
repo=https://github.com/common-workflow-language/cwltest.git
9-
run_tests="cwltest --help"
9+
run_tests="py.test --pyarg ${module}"
1010
pipver=8.0.1 # minimum required version of pip
1111
setupver=20.10.1 # minimum required version of setuptools
1212

setup.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ ignore = E124,E128,E129,E201,E202,E225,E226,E231,E265,E271,E302,E303,F401,E402,E
55

66
[bdist_wheel]
77
universal = 1
8+
9+
[tool:pytest]
10+
testpaths = tests
11+
12+
[aliases]
13+
test=pytest

setup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
'six>=1.10.0'
2323
]
2424

25+
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
26+
pytest_runner = ['pytest-runner'] if needs_pytest else []
27+
2528
if sys.version_info.major == 2:
2629
install_requires.extend(['futures >= 3.0.5', 'subprocess32'])
2730

@@ -37,10 +40,13 @@
3740
url="https://github.com/common-workflow-language/cwltest",
3841
download_url="https://github.com/common-workflow-language/cwltest",
3942
license='Apache 2.0',
40-
packages=["cwltest"],
43+
packages=["cwltest", "cwltest.tests"],
44+
package_dir={'cwltest.tests': 'tests'},
45+
include_package_data=True,
4146
install_requires=install_requires,
4247
test_suite='tests',
43-
tests_require=[],
48+
setup_requires=[] + pytest_runner,
49+
tests_require=['pytest'],
4450
entry_points={
4551
'console_scripts': ["cwltest=cwltest:main"]
4652
},

tests/test_compare.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,18 @@
11
import unittest
2+
from .util import get_data
23
from cwltest import CompareFail
34
from cwltest.utils import compare_file, compare
45

56

6-
class TestCompare(unittest.TestCase):
7-
8-
def compare_success(self, expected, actual):
9-
try:
10-
compare(expected, actual)
11-
except CompareFail:
12-
self.fail("Comparison failed unexpectedly")
13-
14-
15-
class TestCompareFile(TestCompare):
7+
class TestCompareFile(unittest.TestCase):
168

179
def test_compare_file(self):
1810
expected = {
1911
"location": "cores.txt",
2012
"size": 2,
2113
"class": "File",
2214
"checksum": "sha1$7448d8798a4380162d4b56f9b452e2f6f9e24e7a"
23-
}
15+
}
2416

2517
actual = {
2618
"basename": "cores.txt",
@@ -48,10 +40,10 @@ def test_compare_contents_success(self):
4840
"checksum": "sha1$7448d8798a4380162d4b56f9b452e2f6f9e24e7a",
4941
"class": "File",
5042
"location": "file:///var/folders/8x/2df05_7j20j6r8y81w4qf43r0000gn/T/tmpG0EkrS/cores.txt",
51-
"path": "tests/test-data/cores.txt",
43+
"path": get_data("tests/test-data/cores.txt"),
5244
"size": 2
5345
}
54-
self.compare_success(expected, actual)
46+
compare(expected, actual)
5547

5648
def test_compare_contents_failure(self):
5749
expected = {
@@ -66,7 +58,7 @@ def test_compare_contents_failure(self):
6658
"checksum": "sha1$7448d8798a4380162d4b56f9b452e2f6f9e24e7a",
6759
"class": "File",
6860
"location": "file:///var/folders/8x/2df05_7j20j6r8y81w4qf43r0000gn/T/tmpG0EkrS/cores.txt",
69-
"path": "tests/test-data/cores.txt",
61+
"path": get_data("tests/test-data/cores.txt"),
7062
"size": 2
7163
}
7264
with self.assertRaises(CompareFail):

tests/util.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from __future__ import absolute_import
2+
import os
3+
4+
from pkg_resources import (Requirement, ResolutionError, # type: ignore
5+
resource_filename)
6+
7+
8+
def get_data(filename):
9+
filename = os.path.normpath(
10+
filename) # normalizing path depending on OS or else it will cause problem when joining path
11+
filepath = None
12+
try:
13+
filepath = resource_filename(
14+
Requirement.parse("cwltest"), filename)
15+
except ResolutionError:
16+
pass
17+
if not filepath or not os.path.isfile(filepath):
18+
filepath = os.path.join(os.path.dirname(__file__), os.pardir, filename)
19+
return filepath

tox.ini

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
#envlist = py35-lint,py34-lint,py33-lint,py27-lint,py35-unit,py34-unit,py33-unit,py27-unit
3-
envlist = py27-lint, py27-unit, py35-mypy{2,3}
3+
envlist = py27-lint, py{27,33,34,35}-unit, py35-mypy{2,3}
44
skipsdist = True
55

66
[travis]
@@ -12,7 +12,9 @@ python =
1212
3.5: py35-mypy{2,3}
1313

1414
[testenv]
15-
deps = -rrequirements.txt
15+
deps =
16+
pytest
17+
-rrequirements.txt
1618

1719
[testenv:py35-mypy2]
1820
commands = make mypy2
@@ -49,13 +51,14 @@ whitelist_externals = flake8
4951
deps = flake8
5052

5153
[testenv:py35-unit]
52-
commands = python setup.py test
54+
commands = pytest {posargs} # substitute with tox' positional arguments
5355

5456
[testenv:py34-unit]
55-
commands = python setup.py test
57+
commands = pytest {posargs} # substitute with tox' positional arguments
5658

5759
[testenv:py33-unit]
58-
commands = python setup.py test
60+
commands = pytest {posargs} # substitute with tox' positional arguments
5961

6062
[testenv:py27-unit]
61-
commands = python setup.py test
63+
commands = pytest {posargs} # substitute with tox' positional arguments
64+

0 commit comments

Comments
 (0)