Quellcode durchsuchen

initial python tests on GitHub

Konstantin Ladutenko vor 2 Jahren
Ursprung
Commit
f05aa36d40
6 geänderte Dateien mit 20 neuen und 7 gelöschten Zeilen
  1. 1 1
      .github/workflows/cmake.yml
  2. 3 0
      CMakeLists.txt
  3. 3 0
      pyproject.toml
  4. 1 6
      requirements.txt
  5. 1 0
      setup.py
  6. 11 0
      tox.ini

+ 1 - 1
.github/workflows/cmake.yml

@@ -22,7 +22,7 @@ jobs:
 
       # without GTest and Boost
       - name: Install Python NumPy and Pybind11
-        run: sudo apt install python-numpy python-all-dev python-numpy-dev python3-pybind11
+        run: sudo apt install python-numpy python-all-dev python-numpy-dev python3-pybind11 && sudo pip3 install tox
 
       - name: Configure CMake
         # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.

+ 3 - 0
CMakeLists.txt

@@ -119,3 +119,6 @@ add_subdirectory(tests)
 add_test(NAME BuildExtWithPythonSetupPy
    COMMAND ${Python_EXECUTABLE} setup.py build_ext
     WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 
+add_test(NAME tox
+    COMMAND tox) 
+ 

+ 3 - 0
pyproject.toml

@@ -0,0 +1,3 @@
+[build-system]
+requires = ["setuptools", "pybind11", "numpy"]
+build-backend = "setuptools.build_meta"

+ 1 - 6
requirements.txt

@@ -1,6 +1 @@
-scipy~=1.3.3
-numpy~=1.17.4
-matplotlib~=3.1.2
-PyYAML~=5.3.1
-pybind11~=2.4.3
-setuptools~=45.2.0
+.

+ 1 - 0
setup.py

@@ -84,6 +84,7 @@ def run_setup(extensions):
           license='GPL',
           platforms='any',
           packages=['scattnlay'],  # , 'scattnlay_dp', 'scattnlay_mp'],
+          test_suite="tests",
           ext_modules=extensions
           )
 

+ 11 - 0
tox.ini

@@ -0,0 +1,11 @@
+# tox (https://tox.readthedocs.io/) is a tool for running tests
+# in multiple virtualenvs. This configuration file will run the
+# test suite on all supported python versions. To use it, "pip install tox"
+# and then run "tox" from this directory.
+
+[tox]
+envlist = py38, py39, py310
+
+[testenv]
+commands =
+    python -m unittest tests/test_py.py