Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
PyTest Inner Workings Overhaul
Browse files Browse the repository at this point in the history
This PR makes an overhaul to the nuances of our PyTest framework.

* In order to ship around the testing configuration (the contents of
  `conftest.py`), this PR ports all of those features to the `testing.py`
  file which is now treated as a first class PyTest Plugin.
* The `pytest11` entry point for the `testing.py` file has been added
  to the `setup.py` file so it will be detected automatically by any
  installed PyTest, allowing transferring of the `--runslow` and
  `--runexamples` CLI flags into PyTest on its own.
    * This also enables the ability to access these flags anywhere
* Due to the removal of the [pytest.config global](https://docs.pytest.org/en/latest/deprecations.html#pytest-config-global) in the Version 5+ of PyTest, I had to
  rework how some of our `mark` functions behave. Instead of writing
  our own decorators, I instead am using the PyTest recommended method
  of `pytest_collection_modifyitems`, an example of which can be found
  [here](https://docs.pytest.org/en/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option).
  I have also based this off the implementation this from Dask Distributed
  dask/distributed#2677.
* Due to the previous change, the `mark_slow` and `mark_example`
  decorators are no more. We now just use `pytest.mark.slow` and
  `pytest.mark.example` respectively. This change has been propagated
  through the tests.
* I fixed a bug in the `test_visualization` where the `_has_plotly` flag
  was always being set to `True`.
* I have tested this with both PyTest 5 and PyTest 4.6.3

And finally, all of this, was so we could install QCFractal and run
`pytest --pyargs qcfractal` from anywhere and still have access to the
optional `--runslow` flag (and it solved a PyTest 5 deprecation)
  • Loading branch information
Lnaden committed Aug 20, 2019
1 parent 6bcbe1c commit 6f3e670
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tests/test_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from . import portal

try:
import plotly
_has_ploty = True
except ModuleNotFoundError:
_has_ploty = False
Expand Down

0 comments on commit 6f3e670

Please sign in to comment.