Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Roel Aaij
k40gen
Commits
6f44fdc1
Commit
6f44fdc1
authored
Feb 25, 2019
by
Roel Aaij
Browse files
Try to run some tests.
parent
bfccdea3
Changes
2
Hide whitespace changes
Inline
Side-by-side
setup.cfg
View file @
6f44fdc1
[aliases]
test = pytest
#
[aliases]
#
test = pytest
setup.py
View file @
6f44fdc1
from
distutils.version
import
LooseVersion
from
setuptools
import
setup
,
Extension
from
setuptools.command.build_ext
import
build_ext
from
setuptools.command.test
import
test
as
test_ext
import
sys
import
os
import
re
import
platform
import
subprocess
import
sysconfig
__version__
=
'0.0.1'
...
...
@@ -67,6 +69,30 @@ class CMakeBuild(build_ext):
print
()
# Add an empty line for cleaner output
class
CatchTestCommand
(
test_ext
):
"""
A custom test runner to execute both Python unittest tests and C++ Catch-
lib tests.
"""
def
distutils_dir_name
(
self
,
dname
):
"""Returns the name of a distutils build directory"""
dir_name
=
"{dirname}.{platform}-{version[0]}.{version[1]}"
return
dir_name
.
format
(
dirname
=
dname
,
platform
=
sysconfig
.
get_platform
(),
version
=
sys
.
version_info
)
def
run
(
self
):
# Run Python tests
super
(
CatchTestCommand
,
self
).
run
()
print
(
"
\n
Python tests complete, now running C++ tests...
\n
"
)
# Run catch tests
subprocess
.
call
([
'ctest -V'
],
cwd
=
os
.
path
.
join
(
'build'
,
self
.
distutils_dir_name
(
'temp'
)),
shell
=
True
)
ext_modules
=
[
CMakeExtension
(
'k40gen'
)
]
...
...
@@ -84,6 +110,6 @@ setup(
setup_requires
=
[
'pytest-runner'
,
'numpy'
,
'cmake'
],
install_requires
=
[
'numpy'
],
tests_require
=
[
"pytest"
],
cmdclass
=
dict
(
build_ext
=
CMakeBuild
),
cmdclass
=
dict
(
build_ext
=
CMakeBuild
,
test
=
CatchTestCommand
),
zip_safe
=
False
,
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment