Fix how the test rustapi_module is built
This commit is contained in:
parent
cca8eb43d6
commit
149a13cbfa
2
tests/rustapi_module/pyproject.toml
Normal file
2
tests/rustapi_module/pyproject.toml
Normal file
|
@ -0,0 +1,2 @@
|
|||
[build-system]
|
||||
requires = ["setuptools", "wheel", "setuptools_rust>=0.10.2"]
|
|
@ -1,3 +1,3 @@
|
|||
hypothesis>=3.55
|
||||
pytest>=3.5.0
|
||||
setuptools-rust>=0.9.1
|
||||
setuptools-rust>=0.10.2
|
||||
|
|
|
@ -2,17 +2,7 @@ import sys
|
|||
|
||||
from setuptools import setup
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
try:
|
||||
from setuptools_rust import RustExtension
|
||||
except ImportError:
|
||||
import subprocess
|
||||
errno = subprocess.call([sys.executable, '-m', 'pip', 'install', 'setuptools-rust'])
|
||||
if errno:
|
||||
print("Please install setuptools-rust package")
|
||||
raise SystemExit(errno)
|
||||
else:
|
||||
from setuptools_rust import RustExtension
|
||||
from setuptools_rust import RustExtension
|
||||
|
||||
|
||||
class PyTest(TestCommand):
|
||||
|
@ -26,6 +16,20 @@ class PyTest(TestCommand):
|
|||
raise SystemExit(errno)
|
||||
|
||||
|
||||
def get_py_version_cfgs():
|
||||
# For now each Cfg Py_3_X flag is interpreted as "at least 3.X"
|
||||
version = sys.version_info[0:2]
|
||||
|
||||
if version[0] == 2:
|
||||
return ['--cfg=Py_2']
|
||||
|
||||
py3_min = 5
|
||||
out_cfg = []
|
||||
for minor in range(py3_min, version[1]+1):
|
||||
out_cfg.append('--cfg=Py_3_%d' % minor)
|
||||
|
||||
return out_cfg
|
||||
|
||||
setup_requires = ['setuptools-rust>=0.6.1']
|
||||
install_requires = []
|
||||
tests_require = install_requires + ['pytest', 'pytest-benchmark']
|
||||
|
@ -43,7 +47,8 @@ setup(
|
|||
'Operating System :: MacOS :: MacOS X',
|
||||
],
|
||||
packages=['rustapi_module'],
|
||||
rust_extensions=[RustExtension('rustapi_module.datetime', 'Cargo.toml')],
|
||||
rust_extensions=[RustExtension('rustapi_module.datetime', 'Cargo.toml',
|
||||
rustc_flags=get_py_version_cfgs())],
|
||||
install_requires=install_requires,
|
||||
tests_require=tests_require,
|
||||
setup_requires=setup_requires,
|
||||
|
|
14
tests/rustapi_module/tox.ini
Normal file
14
tests/rustapi_module/tox.ini
Normal file
|
@ -0,0 +1,14 @@
|
|||
[tox]
|
||||
envlist = py27,
|
||||
py35,
|
||||
py36,
|
||||
py37,
|
||||
minversion = 2.9.0
|
||||
skip_missing_interpreters = true
|
||||
|
||||
[testenv]
|
||||
description = Run the unit tests under {basepython}
|
||||
deps = -rrequirements-dev.txt
|
||||
usedevelop = True
|
||||
commands = pip install -e .
|
||||
pytest
|
Loading…
Reference in a new issue