Skip to content

Commit 196146f

Browse files
authored
Merge pull request #219 from IdentityPython/ft-use-pytest
use pytest, since nosetests isn't maintained anymore.
2 parents d4c2470 + 2982f7f commit 196146f

File tree

7 files changed

+369
-526
lines changed

7 files changed

+369
-526
lines changed

.travis.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ install:
1010
- "pip install -r test_requirements.txt"
1111
- "./setup.py develop"
1212
- "pip install coveralls"
13-
- "pip install nose"
13+
- "pip install pytest"
1414
- "pip install mypy"
15-
script:
15+
script:
1616
- export PYTHONPATH=./src:$PYTHONPATH
17-
- coverage erase
18-
- coverage run --source=pyff setup.py test
19-
- mv .coverage .coverage.1
20-
- coverage combine
17+
- make test_coverage
2118
- make typecheck
2219
before_install:
2320
- sudo apt-get update -qq

Makefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
SOURCE= src
1+
TOPDIR:= $(abspath .)
2+
SRCDIR= $(TOPDIR)/src
3+
SOURCE= $(SRCDIR)/pyff
4+
5+
test:
6+
PYTHONPATH=$(SRCDIR) pytest
7+
8+
quick_test:
9+
PYFF_SKIP_SLOW_TESTS=1 PYTHONPATH=$(SRCDIR) pytest
10+
11+
test_coverage:
12+
coverage erase
13+
PYTHONPATH=$(SRCDIR) pytest --cov=src/pyff
14+
mv .coverage .coverage.1
15+
coverage combine
216

317
reformat:
418
isort --line-width 120 --atomic --project eduid_scimapi --recursive $(SOURCE)

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ httplib2 >=0.7.7
66
ipaddr
77
lxml >=4.1.1
88
mako
9-
nose
109
pyXMLSecurity >=0.15
1110
pyconfig
1211
pyramid

setup.py

Lines changed: 34 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
__author__ = 'Leif Johansson'
1515
__version__ = '2.0.0'
1616

17+
1718
def load_requirements(path: PurePath) -> List[str]:
1819
""" Load dependencies from a requirements.txt style file, ignoring comments etc. """
1920
res = []
@@ -27,6 +28,7 @@ def load_requirements(path: PurePath) -> List[str]:
2728
res += [line]
2829
return res
2930

31+
3032
here = PurePath(__file__)
3133
README = open(here.with_name('README.rst')).read()
3234
NEWS = open(here.with_name('NEWS.txt')).read()
@@ -36,45 +38,35 @@ def load_requirements(path: PurePath) -> List[str]:
3638

3739
python_implementation_str = python_implementation()
3840

39-
setup(name='pyFF',
40-
version=__version__,
41-
description="Federation Feeder",
42-
long_description=README + '\n\n' + NEWS,
43-
classifiers=[
44-
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
45-
'Programming Language :: Python :: 3',
46-
'Programming Language :: Python :: 3.7',
47-
'Programming Language :: Python :: 3.8',
48-
],
49-
keywords='identity federation saml metadata',
50-
author=__author__,
51-
author_email='leifj@sunet.se',
52-
url='https://pyff.io',
53-
license='BSD',
54-
setup_requires=['nose>=1.0'],
55-
tests_require=tests_require,
56-
test_suite="nose.collector",
57-
packages=find_packages('src'),
58-
package_dir={'': 'src'},
59-
include_package_data=True,
60-
package_data={
61-
'pyff': ['xslt/*.xsl', 'schema/*.xsd']
62-
},
63-
zip_safe=False,
64-
install_requires=install_requires,
65-
scripts=['scripts/mirror-mdq.sh'],
66-
entry_points={
67-
'console_scripts': ['pyff=pyff.md:main', 'pyffd=pyff.mdq:main', 'samldiff=pyff.tools:difftool'],
68-
'paste.app_factory': [
69-
'pyffapp=pyff.wsgi:app_factory'
70-
],
71-
'paste.server_runner': [
72-
'pyffs=pyff.wsgi:server_runner'
73-
],
74-
},
75-
message_extractors={'src': [
76-
('**.py', 'python', None),
77-
('**/templates/**.html', 'mako', None),
78-
]},
79-
python_requires='>=3.7',
80-
)
41+
setup(
42+
name='pyFF',
43+
version=__version__,
44+
description="Federation Feeder",
45+
long_description=README + '\n\n' + NEWS,
46+
classifiers=[
47+
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
48+
'Programming Language :: Python :: 3',
49+
'Programming Language :: Python :: 3.7',
50+
'Programming Language :: Python :: 3.8',
51+
],
52+
keywords='identity federation saml metadata',
53+
author=__author__,
54+
author_email='leifj@sunet.se',
55+
url='https://pyff.io',
56+
license='BSD',
57+
tests_require=tests_require,
58+
packages=find_packages('src'),
59+
package_dir={'': 'src'},
60+
include_package_data=True,
61+
package_data={'pyff': ['xslt/*.xsl', 'schema/*.xsd']},
62+
zip_safe=False,
63+
install_requires=install_requires,
64+
scripts=['scripts/mirror-mdq.sh'],
65+
entry_points={
66+
'console_scripts': ['pyff=pyff.md:main', 'pyffd=pyff.mdq:main', 'samldiff=pyff.tools:difftool'],
67+
'paste.app_factory': ['pyffapp=pyff.wsgi:app_factory'],
68+
'paste.server_runner': ['pyffs=pyff.wsgi:server_runner'],
69+
},
70+
message_extractors={'src': [('**.py', 'python', None), ('**/templates/**.html', 'mako', None),]},
71+
python_requires='>=3.7',
72+
)

src/pyff/test/test_md_api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import unittest
55
from datetime import datetime, timezone
66

7+
import pytest
78
import requests
89
from mako.lookup import TemplateLookup
910
from wsgi_intercept.interceptor import RequestsInterceptor, UrllibInterceptor
@@ -100,6 +101,7 @@ def test_webfinger_rel_dj(self):
100101
assert link['rel'] not in 'urn:oasis:names:tc:SAML:2.0:metadata'
101102
assert 'href' in link
102103

104+
@pytest.mark.skipif(os.environ.get('PYFF_SKIP_SLOW_TESTS') is not None, reason='Slow tests skipped')
103105
def test_load_and_query(self):
104106
with RequestsInterceptor(self.app, host='127.0.0.1', port=80) as url:
105107
r = requests.post("{}/api/call/update".format(url))

0 commit comments

Comments
 (0)