Running the tests locally

Why do all of the fail when I run the tests locally?
I am doing

$ pytest

in the root of the bokeh repo. I haven’t touched any of the example files.

Just noticed others have asked this question, but still stumped. FYI the other tests work fine.

@jeremy9959 There are lots of different kinds of tests under the tests directory:

  • Python unit tests
  • JavaScript unit tests
  • Selenium integration tests
  • Codebase checks
  • Examples tests

The “examples tests” are, first and foremost, present to be run on CI. That suite runs hundreds of image diff tests on every Bokeh example in the repo. It might take 30 or more minutes to complete. It also computes baseline layout geometries that currently are calibrated to the headless browser on the CI system, and which due to slight platform differences outside our control, may report failures on other systems. Besides all that, the necessary requirements to run this test suite are fairly onerous to install. It’s not expected that anyone is running these locally with any regularity (that is what the CI pipeline is for).

TLDR, you need to be more specific. If you just want to run the basic Python unit tests, you can do that:

py.test tests/unit

More detailed information about running tests is in the Developer’s Guide.

Thanks – I was trying to avoid the process of pushing my PR and getting silly formatting mistakes. Knowing that the examples test are intended for CI is helpful, then I don’t have to worry about them.

@jeremy9959 You can run the code base tests like this:

py.test tests/codebase

Please make sure you have also run pip install channels or else isort will get confused.

You might also want to consider adding the codebase checks as a Git commit hook. (Looking at that I see it is slightly out of date and still uses -m codebase instead of the path, an issue or quick PR to fix would be appreciated!)

Is there a reason you prefer
py.test tests/codebase
pytest tests/codebase

It’s just how I learned / habit.