Browse Source

Adolgert limit pytest path (#137)

* Add pytest to main readme and configure tests directory with pytest.ini

* responses to PR comments to add pytest-3 and fix a typo.

---------

Co-authored-by: Drew Dolgert <adolgert@andrew.cmu.edu>
Andrew Dolgert 1 year ago
parent
commit
10a616382e
3 changed files with 17 additions and 5 deletions
  1. 8 0
      README.md
  2. 3 0
      pytest.ini
  3. 6 5
      tests/README.md

+ 8 - 0
README.md

@@ -91,6 +91,14 @@ which creates a lib folder, moves the built `.so` file into that lib folder, and
 
 **Note** You may wish to copy the `.so` file to any projects of your own, or add it to your system path to source from.
 
+## Running Tests
+
+Run tests with [pytest](https://docs.pytest.org), which may be called `pytest-3` on your system. See the [testing readme](tests/README.md) for more information.
+
+```bash
+pytest [--run-long]
+```
+
 ## Code Examples
 
 To get familiar with the OpenFHE Python API, check out the examples:

+ 3 - 0
pytest.ini

@@ -0,0 +1,3 @@
+[pytest]
+testpaths =
+    tests

+ 6 - 5
tests/README.md

@@ -1,10 +1,10 @@
 # Working with Tests
 
-These tests use Pytest (https://docs.pytest.org/).
+These tests use [Pytest](https://docs.pytest.org/).
 
 ## Running and Using Tests
 
-These tests assume that openfhe-python is installed in the current python environment, which you can check by running
+These tests assume that openfhe-python is installed in the current python environment, which you can check by importing openfhe.
 ```bash
 python -c "__import__('openfhe')"
 ```
@@ -22,7 +22,7 @@ pytest --run-all
 
 ### General Pytest usage
 
-Test a particular file:
+This is a quick reminder of pytest's features. To test a particular file:
 
 ```bash
 pytest test_particular_file.py
@@ -35,7 +35,8 @@ Test all functions matching a name. For instance, this would pick up
 pytest -k add
 ```
 
-As a reminder, pytest can be helpful for debugging.
+As a reminder, pytest can be helpful for debugging. This command-line option
+shows debug output from logging statements.
 
 ```bash
 pytest --log-cli-level=debug
@@ -64,7 +65,7 @@ The goal is for the Github Actions tests to reassure a committer that they have
 not broken the Python wrapper.
 
 **Import OpenFHE as fhe** -- Unit tests tend to use more imports than most
-code, for instance JSON, which conflicts with an OpenFHE name, so quality
+code, for instance JSON, which conflicts with an OpenFHE name, so qualify
 imports in the tests.
 
 ```python