Skip to content

use pytest, since nosetests isn't maintained anymore. #219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ install:
- "pip install -r test_requirements.txt"
- "./setup.py develop"
- "pip install coveralls"
- "pip install nose"
- "pip install pytest"
- "pip install mypy"
script:
script:
- export PYTHONPATH=./src:$PYTHONPATH
- coverage erase
- coverage run --source=pyff setup.py test
- mv .coverage .coverage.1
- coverage combine
- make test_coverage
- make typecheck
before_install:
- sudo apt-get update -qq
Expand Down
16 changes: 15 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
SOURCE= src
TOPDIR:= $(abspath .)
SRCDIR= $(TOPDIR)/src
SOURCE= $(SRCDIR)/pyff

test:
PYTHONPATH=$(SRCDIR) pytest

quick_test:
PYFF_SKIP_SLOW_TESTS=1 PYTHONPATH=$(SRCDIR) pytest

test_coverage:
coverage erase
PYTHONPATH=$(SRCDIR) pytest --cov=src/pyff
mv .coverage .coverage.1
coverage combine

reformat:
isort --line-width 120 --atomic --project eduid_scimapi --recursive $(SOURCE)
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ httplib2 >=0.7.7
ipaddr
lxml >=4.1.1
mako
nose
pyXMLSecurity >=0.15
pyconfig
pyramid
Expand Down
76 changes: 34 additions & 42 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
__author__ = 'Leif Johansson'
__version__ = '2.0.0'


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


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

python_implementation_str = python_implementation()

setup(name='pyFF',
version=__version__,
description="Federation Feeder",
long_description=README + '\n\n' + NEWS,
classifiers=[
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
keywords='identity federation saml metadata',
author=__author__,
author_email='leifj@sunet.se',
url='https://pyff.io',
license='BSD',
setup_requires=['nose>=1.0'],
tests_require=tests_require,
test_suite="nose.collector",
packages=find_packages('src'),
package_dir={'': 'src'},
include_package_data=True,
package_data={
'pyff': ['xslt/*.xsl', 'schema/*.xsd']
},
zip_safe=False,
install_requires=install_requires,
scripts=['scripts/mirror-mdq.sh'],
entry_points={
'console_scripts': ['pyff=pyff.md:main', 'pyffd=pyff.mdq:main', 'samldiff=pyff.tools:difftool'],
'paste.app_factory': [
'pyffapp=pyff.wsgi:app_factory'
],
'paste.server_runner': [
'pyffs=pyff.wsgi:server_runner'
],
},
message_extractors={'src': [
('**.py', 'python', None),
('**/templates/**.html', 'mako', None),
]},
python_requires='>=3.7',
)
setup(
name='pyFF',
version=__version__,
description="Federation Feeder",
long_description=README + '\n\n' + NEWS,
classifiers=[
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
keywords='identity federation saml metadata',
author=__author__,
author_email='leifj@sunet.se',
url='https://pyff.io',
license='BSD',
tests_require=tests_require,
packages=find_packages('src'),
package_dir={'': 'src'},
include_package_data=True,
package_data={'pyff': ['xslt/*.xsl', 'schema/*.xsd']},
zip_safe=False,
install_requires=install_requires,
scripts=['scripts/mirror-mdq.sh'],
entry_points={
'console_scripts': ['pyff=pyff.md:main', 'pyffd=pyff.mdq:main', 'samldiff=pyff.tools:difftool'],
'paste.app_factory': ['pyffapp=pyff.wsgi:app_factory'],
'paste.server_runner': ['pyffs=pyff.wsgi:server_runner'],
},
message_extractors={'src': [('**.py', 'python', None), ('**/templates/**.html', 'mako', None),]},
python_requires='>=3.7',
)
4 changes: 2 additions & 2 deletions src/pyff/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def __init__(self, name=None):
name = __name__
self._log = logging.getLogger(name)
self._loggers = {
logging.WARN: self._log.warn,
logging.WARNING: self._log.warn,
logging.WARN: self._log.warning,
logging.WARNING: self._log.warning,
logging.CRITICAL: self._log.critical,
logging.INFO: self._log.info,
logging.DEBUG: self._log.debug,
Expand Down
2 changes: 2 additions & 0 deletions src/pyff/test/test_md_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import unittest
from datetime import datetime, timezone

import pytest
import requests
from mako.lookup import TemplateLookup
from wsgi_intercept.interceptor import RequestsInterceptor, UrllibInterceptor
Expand Down Expand Up @@ -96,6 +97,7 @@ def test_webfinger_rel_dj(self):
assert link['rel'] not in 'urn:oasis:names:tc:SAML:2.0:metadata'
assert 'href' in link

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