Skip to content

Commit

Permalink
fix tox env and add pytest options
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Brulatout committed Aug 24, 2023
1 parent f018082 commit 339b722
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 10 deletions.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

[tool.black]
line-length = 120
target-version = ['py39']
Expand All @@ -11,6 +10,10 @@ case_sensitive = true
profile = "black"
src_paths = ["."]

[tool.pytest.ini_options]
addopts = "--cov=. --cov-context=test --durations=0 --durations-min=1.0"
asyncio_mode = "auto"

[tool.pylint]
ignored-classes=["twisted.internet.reactor"]
ignore-paths=["docs/"]
Expand Down
11 changes: 4 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from setuptools.command.test import test as TestCommand

with open("consul/__init__.py", encoding="utf-8") as f:
metadata = dict(re.findall("__([a-z]+)__ = '([^']+)'", f.read()))
metadata = dict(re.findall('__([a-z]+)__ = "([^"]+)"', f.read()))


def _read_reqs(relpath: str):
Expand All @@ -17,10 +17,6 @@ def _read_reqs(relpath: str):
return [s.strip() for s in f.readlines() if (s.strip() and not s.startswith("#"))]


requirements = _read_reqs("requirements.txt")
tests_requirements = _read_reqs("tests-requirements.txt")


description = "Python client for Consul (http://www.consul.io/)"


Expand Down Expand Up @@ -59,13 +55,14 @@ def run_tests(self):
description=description,
long_description=long_description,
py_modules=py_modules,
install_requires=requirements,
install_requires=_read_reqs("requirements.txt"),
extras_require={
"tornado": ["tornado"],
"asyncio": ["aiohttp"],
"twisted": ["twisted", "treq"],
},
tests_require=tests_requirements,
data_files=[(".", ["requirements.txt", "tests-requirements.txt"])],
tests_require=_read_reqs("tests-requirements.txt"),
cmdclass={"test": PyTest, "install": Install},
classifiers=[
"Development Status :: 3 - Alpha",
Expand Down
9 changes: 7 additions & 2 deletions tests-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
-r requirements.txt
aiohttp
asynctest
black
isort
pre-commit
pyOpenSSL
pylint
pytest
pytest_asyncio
pytest-cov
pytest-rerunfailures
pytest-twisted
pytest-xdist
ruff
setuptools
tornado
tox
treq
twisted
virtualenv
virtualenv
wheel
9 changes: 9 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ commands =
deps = -r tests-requirements.txt
commands =
pre-commit run --all-files

# Bundle environment puts stuff in 'dist'.
[testenv:bundle]
skip_install = True
commands =
# Creates a source archive in sdist/.
{envpython} setup.py sdist --dist-dir=sdist --format=gztar
# Puts binary archives in dist/.
{envpython} setup.py bdist --dist-dir=dist --format=gztar

0 comments on commit 339b722

Please sign in to comment.