tethysplatform / tethys

The Tethys Platform main Django website project repository.
http://tethysplatform.org/
BSD 2-Clause "Simplified" License
94 stars 51 forks source link

Testing apps doesn't work without tethys source code #888

Open sdc50 opened 1 year ago

sdc50 commented 1 year ago

Currently the test framework in apps suggests that apps run tests with the tethys test command. This command will only work if the tethys source code is present (i.e. will not work if tethys is installed from conda).

There is a simple check in the test command to see if the tests source code is present. We could add additional checks to see if the test command is trying to run tests on an app rather than on tethys itself.

Alternatively, with the new manage command tests can also be run with tethys manage test. It may be better to just change the documentation (including in the app scaffold) to instruct users to run app tests with tethys manage test rather than with tethys test.

swainn commented 1 year ago

Duplicate of #640

swainn commented 1 year ago

The error that is raise when trying to run the tests without source:

https://github.com/tethysplatform/tethys/blob/dd6fdd8d1f1e27d0c5fa745915332427d23ef5b1/tethys_cli/test_command.py#L90-L95

swainn commented 1 year ago

Tethys Test Case class has helpful methods for working with persistent stores:

https://github.com/tethysplatform/tethys/blob/dd6fdd8d1f1e27d0c5fa745915332427d23ef5b1/tethys_apps/base/testing/testing.py#L57-L93

swainn commented 1 year ago

The instructions in the scaffolded test file are out of date:

https://github.com/tethysplatform/tethys/blob/dd6fdd8d1f1e27d0c5fa745915332427d23ef5b1/tethys_cli/scaffold_templates/app_templates/default/tethysapp/%2Bproject%2B/tests/tests.py_tmpl#L18-L49****

swainn commented 1 year ago

Short term: Update docs to use tethys manage test -f <path> command.

Long term: Create a tethys test --app <app_name> command.

swainn commented 1 year ago

Docs were updated in #890