1+ import multiprocessing
12import sys
23
34from setuptools import find_packages , setup
910 required = f .read ().splitlines ()
1011URL = "https://github.com/bogdandm/json2python-models"
1112
13+ CPU_N = multiprocessing .cpu_count ()
14+
1215
1316class PyTest (TestCommand ):
1417 user_options = [("pytest-args=" , "a" , "Arguments to pass to pytest" )]
@@ -20,8 +23,10 @@ def initialize_options(self):
2023 def run_tests (self ):
2124 import shlex
2225 import pytest
23-
24- errno = pytest .main (shlex .split (self .pytest_args + ' -m "not slow_http"' ))
26+ args = self .pytest_args
27+ if CPU_N > 1 and "-n " not in args :
28+ args += f" -n { CPU_N } "
29+ errno = pytest .main (shlex .split (args ))
2530 sys .exit (errno )
2631
2732
@@ -31,6 +36,7 @@ def run_tests(self):
3136 python_requires = ">=3.7" ,
3237 url = URL ,
3338 author = "bogdandm (Bogdan Kalashnikov)" ,
39+ author_email = "bogdan.dm1995@yandex.ru" ,
3440 description = "Python models (attrs, dataclasses or custom) generator from JSON data with typing module support" ,
3541 license = "MIT" ,
3642 packages = find_packages (exclude = ['test' , 'testing_tools' ]),
@@ -39,9 +45,6 @@ def run_tests(self):
3945 },
4046 install_requires = required ,
4147 cmdclass = {"test" : PyTest },
42- tests_require = ["pytest" , "requests" , "attrs" ],
43- project_urls = {
44- 'Source' : URL
45- },
48+ tests_require = ["pytest" , "pytest-xdist" , "requests" , "attrs" ],
4649 data_files = [('' , ['pytest.ini' , '.coveragerc' , 'LICENSE' ])]
4750)
0 commit comments