summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--setup.cfg15
-rw-r--r--setup.py22
-rw-r--r--test-requirements.txt4
4 files changed, 41 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 894b10a..70028ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
/MANIFEST
/dist/
__pycache__/
+.cache
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..cd71828
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,15 @@
+[tool:pytest]
+addopts =
+ --color=yes
+ --ignore=setup.py
+ --ignore=test-requirements.txt
+ -r a
+norecursedirs =
+ .git
+ dist
+ build
+ venv
+ .env
+testpaths =
+ test
+timeout = 120
diff --git a/setup.py b/setup.py
index d7cc51f..c49745a 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,23 @@
# -*- coding: utf-8 -*-
+import sys
+
from setuptools import setup, find_packages
+from setuptools.command.test import test as TestCommand
+
+
+with open('test-requirements.txt') as requirements:
+ test_required = requirements.read().splitlines()
+
+
+class PyTestCommand(TestCommand):
+
+ def run_tests(self):
+ # import here, cause outside the eggs aren't loaded
+ import pytest
+ errno = pytest.main([])
+ sys.exit(errno)
+
setup(
name = 'glucometerutils',
@@ -27,8 +44,8 @@ setup(
data_files = [
('lib/udev/rules', ['udev/69-glucometerutils.rules']),
],
+ tests_require = test_required,
extras_require = {
- 'test': ['absl-py'],
# These are all the drivers' dependencies. Optional dependencies are
# listed as mandatory for the feature.
'otultra2': ['pyserial'],
@@ -46,4 +63,7 @@ setup(
'glucometer=glucometerutils.glucometer:main'
]
},
+ cmdclass = {
+ 'test': PyTestCommand,
+ },
)
diff --git a/test-requirements.txt b/test-requirements.txt
new file mode 100644
index 0000000..9f7c85b
--- /dev/null
+++ b/test-requirements.txt
@@ -0,0 +1,4 @@
+absl-py
+pytest
+pytest-timeout
+pyserial