Skip to content

Commit

Permalink
WIP: testin sphinx build + artifacts x8
Browse files Browse the repository at this point in the history
  • Loading branch information
9and3 committed Aug 16, 2024
1 parent dc0992c commit 1697db1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 32 deletions.
40 changes: 12 additions & 28 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,41 +37,25 @@
import os
import sys

# -- Dlls/pyd imports ---------------------------------------------------------
# import package's modules path and dlls/pyds, checking for import of pybind module
extra_dll_dir_doc = os.path.abspath('./')
extra_dll_dir_pysource = os.path.abspath('./../src/gh/diffCheck')

os.add_dll_directory(extra_dll_dir_doc) # For finding DLL dependencies on Windows
sys.path.insert(0, extra_dll_dir_doc)
sys.path.insert(0, extra_dll_dir_pysource)
try:
import diffCheck.diffcheck_bindings as dfb
except ImportError as e:
print(f"Failed to import diffcheck_bindings: {e}")
print("Current sys.path directories:")
for path in sys.path:
print(path)
print("Current files in the directory:")
for file in os.listdir(extra_dll_dir_doc):
print(file)
sys.exit(1)

# import diffCheck
# print(f"Current diffCheck imported: {diffCheck.__version__}")



# # Workaround to avoid expanding type aliases. See:
# # https://github.com/sphinx-doc/sphinx/issues/6518#issuecomment-589613836
# from typing import ForwardRef

# def _do_not_evaluate_in_diffCheck(
# self, globalns, *args, _evaluate=ForwardRef._evaluate,
# ):
# if globalns.get('__name__', '').startswith('diffCheck'):
# return self
# return _evaluate(self, globalns, *args)
# ForwardRef._evaluate = _do_not_evaluate_in_diffCheck
# try:
# import diffCheck.diffcheck_bindings as dfb
# except ImportError as e:
# print(f"Failed to import diffcheck_bindings: {e}")
# print("Current sys.path directories:")
# for path in sys.path:
# print(path)
# print("Current files in the directory:")
# for file in os.listdir(extra_dll_dir_doc):
# print(file)
# sys.exit(1)

# -- Project information -----------------------------------------------------

Expand Down
17 changes: 13 additions & 4 deletions doc/testing.md → doc/testing.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
(test_guide)=
# Test guide

.. _test_guide:

Testing
=======

In df we use `CTest` as a test framework managed by Cmake in the file `cmake/tests.cmake` to run:
* [c++](cpp_test) tests with `GoogleTest`, and
* [python](py_test) in `PyTest`.

Tests are in the `tests` folder, and here's its structure:

```terminal
F:\DIFFCHECK\TESTS
│ allCppTests.cc
Expand Down Expand Up @@ -41,9 +45,14 @@ cmake --build build --config Release
(py_test)=
## Write Python tests

To write a test, you need to create a new file in the `tests/integration_tests` folder. Write a new `.py` test file and add it in the `cmake/tests.cmake` in the `add_test` function.
To write a test, you need to create a new file in the `tests/integration_tests` folder. Write a new `.py` test file if you are not contributing to an already existing test, and add it in the `cmake/tests.cmake` in the `add_test` function.
e.g.:
https://github.com/diffCheckOrg/diffCheck/blob/e080a93cdd73d96efb0686f80bf13730e0b8efa3/cmake/tests.cmake#L45-L48
```cmake
add_test(NAME PYBIND_UNIT_TEST
COMMAND ${PYTHON_EXECUTABLE} -m pytest ${CMAKE_CURRENT_SOURCE_DIR}/tests/integration_tests/pybinds_tests/test_pybind_units.py
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
```


(cpp_test)=
Expand Down

0 comments on commit 1697db1

Please sign in to comment.