forked from kytos/pathfinder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kytos#22 from kytos-ng/chore/tox_py39_x
Updated tox.ini and removed `tests_require` and `setup_requires`
- Loading branch information
Showing
7 changed files
with
66 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[run] | ||
source = . | ||
omit = .eggs/*,.tox/*,*tests*,setup.py,venv/* | ||
omit = .eggs/*,.tox/*,*tests*,setup.py,venv/*,.venv/*,.direnv/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,32 +69,22 @@ class TestCommand(Command): | |
"""Test tags decorators.""" | ||
|
||
user_options = [ | ||
('size=', None, 'Specify the size of tests to be executed.'), | ||
('type=', None, 'Specify the type of tests to be executed.'), | ||
('k=', None, 'Specify a pytest -k expression.'), | ||
] | ||
|
||
sizes = ('small', 'medium', 'large', 'all') | ||
types = ('unit', 'integration', 'e2e', 'all') | ||
|
||
def get_args(self): | ||
"""Return args to be used in test command.""" | ||
return '--size %s --type %s' % (self.size, self.type) | ||
if self.k: | ||
return f"-k '{self.k}'" | ||
return "" | ||
|
||
def initialize_options(self): | ||
"""Set default size and type args.""" | ||
self.size = 'all' | ||
self.type = 'all' | ||
self.k = "" | ||
|
||
def finalize_options(self): | ||
"""Post-process.""" | ||
try: | ||
assert self.size in self.sizes, ('ERROR: Invalid size:' | ||
f':{self.size}') | ||
assert self.type in self.types, ('ERROR: Invalid type:' | ||
f':{self.type}') | ||
except AssertionError as exc: | ||
print(exc) | ||
sys.exit(-1) | ||
pass | ||
|
||
|
||
class Cleaner(SimpleCommand): | ||
|
@@ -114,18 +104,9 @@ class Test(TestCommand): | |
|
||
description = 'run tests and display results' | ||
|
||
def get_args(self): | ||
"""Return args to be used in test command.""" | ||
markers = self.size | ||
if markers == "small": | ||
markers = 'not medium and not large' | ||
size_args = "" if self.size == "all" else "-m '%s'" % markers | ||
test_type = "" if self.type == "all" else self.type | ||
return '--addopts="tests/%s %s"' % (test_type, size_args) | ||
|
||
def run(self): | ||
"""Run tests.""" | ||
cmd = 'python setup.py pytest %s' % self.get_args() | ||
cmd = 'python3 -m pytest tests/ %s' % self.get_args() | ||
try: | ||
check_call(cmd, shell=True) | ||
except CalledProcessError as exc: | ||
|
@@ -141,8 +122,7 @@ class TestCoverage(Test): | |
|
||
def run(self): | ||
"""Run tests quietly and display coverage report.""" | ||
cmd = 'coverage3 run setup.py pytest %s' % self.get_args() | ||
cmd += '&& coverage3 report' | ||
cmd = 'python3 -m pytest --cov=. tests/ %s' % self.get_args() | ||
try: | ||
check_call(cmd, shell=True) | ||
except CalledProcessError as exc: | ||
|
@@ -168,19 +148,6 @@ def run(self): | |
exit(-1) | ||
|
||
|
||
class CITest(TestCommand): | ||
"""Run all CI tests.""" | ||
|
||
description = 'run all CI tests: unit and doc tests, linter' | ||
|
||
def run(self): | ||
"""Run unit tests with coverage, doc tests and linter.""" | ||
coverage_cmd = 'python3 setup.py coverage %s' % self.get_args() | ||
lint_cmd = 'python3 setup.py lint' | ||
cmd = '%s && %s' % (coverage_cmd, lint_cmd) | ||
check_call(cmd, shell=True) | ||
|
||
|
||
class KytosInstall: | ||
"""Common code for all install types.""" | ||
|
||
|
@@ -296,19 +263,17 @@ def read_requirements(path="requirements/run.txt"): | |
author_email='[email protected]', | ||
license='MIT', | ||
install_requires=read_requirements(), | ||
setup_requires=['pytest-runner'], | ||
tests_require=['pytest==7.0.0'], | ||
extras_require={ | ||
'dev': [ | ||
'coverage', | ||
'pytest==7.0.0', | ||
'pytest-cov==3.0.0', | ||
'pip-tools', | ||
'yala', | ||
'tox', | ||
], | ||
}, | ||
cmdclass={ | ||
'clean': Cleaner, | ||
'ci': CITest, | ||
'coverage': TestCoverage, | ||
'develop': DevelopMode, | ||
'install': InstallMode, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters