Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
2c30f85
Fix test failures
swainn Nov 19, 2025
6bd21af
Prep for running with pytest
swainn Nov 19, 2025
d1938a3
Add pytest configuration to pyproject.toml
swainn Nov 19, 2025
911490e
Configure CI to run tests with pytest
swainn Nov 19, 2025
2910d82
Safer approach
swainn Nov 19, 2025
6fb3592
Add conftest.py to load test app/extension and other helpers
swainn Nov 19, 2025
eb2b3be
Fix import issue
swainn Nov 19, 2025
951c7e4
Add pytest.mark.django_db to tests that require db access
swainn Nov 19, 2025
5b9f66d
format and lint
swainn Nov 19, 2025
1b15abb
fix static finders tests
swainn Nov 19, 2025
a254f6a
Fix handoff tests
swainn Nov 19, 2025
cfd3e24
Fix cli helper tests
swainn Nov 20, 2025
52ada1f
Update job manager tests to pytest
swainn Nov 20, 2025
078f88e
Add pytest debugging helper scripts
swainn Nov 20, 2025
341ef36
rename "test" components in test_library test pages
swainn Nov 20, 2025
17d5365
Fix deprecated datetime.utcnow() usage and references in docs.
swainn Nov 20, 2025
e37a14d
Rename TestGizmo so that pytest won't try loading it as a test case.
swainn Nov 20, 2025
4d1d11e
fix mocks of "test_command" -> "_test_command"
swainn Nov 20, 2025
4d7fb50
Fix proxyapps tests and convert to pytest
swainn Nov 20, 2025
4d33bb0
handle additional edge cases in unittest_to_pytest conversion script
swainn Nov 20, 2025
11ebc6b
Fix broken enforce quota test
swainn Nov 24, 2025
39151d1
Fix tethys_apps/apps tests
swainn Nov 24, 2025
75b96b5
Fix context processor tests
swainn Nov 24, 2025
6ce4f3c
Wasted some time in handoff handlers
swainn Nov 25, 2025
09b56ea
Update core fixtures with lazy/factory versions
swainn Nov 25, 2025
da23bb3
Full coverage on gen commands
swainn Nov 25, 2025
a67a992
Fix bug with handoff get_capabilities as json
swainn Nov 25, 2025
fce2a6b
remove db mark from fixture
swainn Nov 25, 2025
cf77a85
made context processor tests more resilient to running in different e…
swainn Nov 25, 2025
7cc1e94
Fix static finder tests
swainn Nov 25, 2025
36923bc
Make gen command tests catch system exits to prevent exiting tests pr…
swainn Nov 25, 2025
eeb3d42
Make utilities tests more resilient to location where tethys is insta…
swainn Nov 25, 2025
53a379e
datetime.UTC -> datetime.timezone.utc for compatibility with Python 3.10
swainn Nov 26, 2025
778106f
Full coverage for tethys_apps/admin.py
swainn Nov 26, 2025
5696707
Add tests for tethys_quotas/apps.py
swainn Nov 26, 2025
80866c8
Full coverage on tethys_quotas/handlers/base.py
swainn Nov 26, 2025
c346ac0
Add tests for tethys_quotas/handlers/workspace.py
swainn Nov 26, 2025
b9d9a89
Convert tethys_quotas/admin.py tests to pytest
swainn Nov 26, 2025
fcca764
Updated the testing contributor documentation
swainn Nov 26, 2025
95d2136
Add instructions for installing the code-style dependencies
swainn Nov 26, 2025
ad7a9a2
Merge branch 'main' into switch-to-pytest
swainn Dec 22, 2025
4b249a4
Fix gen command tests after merge with main
swainn Dec 22, 2025
1b715e7
add Jacob's test fixes for quotas admin
swainn Dec 22, 2025
6095a78
Fix utilities tests
swainn Dec 22, 2025
343b555
* Added test for coverage
jakeymac Dec 22, 2025
98d2572
Formatting
jakeymac Dec 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tethys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ jobs:
conda activate tethys
conda list
tethys db start
pip install coveralls reactpy_django
pip install coveralls reactpy_django pytest pytest-django pytest-cov
# Test Tethys
- name: Test Tethys
run: |
. ~/miniconda/etc/profile.d/conda.sh
conda activate tethys
tethys test -c -u -v 2
pytest
# Generate Coverage Report
- name: Generate Coverage Report
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == '3.10' && matrix.django-version == '4.2' }}
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ docs/_build
tethys_gizmos/static/tethys_gizmos/less/bower_components/*
node_modules
.eggs/
.coverage
.coverage*
tests/coverage_html_report
.*.swp
.DS_Store
Expand Down
4 changes: 2 additions & 2 deletions docs/contribute/code/dev_environment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Setting Up Development Environment
**********************************

**Last Updated:** January 2025
**Last Updated:** November 2025

The first step in contributing code to Tethys Platform is setting up a development environment. This guide will walk you through the process of setting up a development environment for Tethys Platform.

Expand Down Expand Up @@ -108,7 +108,7 @@ Other Common Development Setups
Use PostGIS Running in Docker
-----------------------------

The most common use case for this setup is to run the test suite. Another common need for using a PostGIS database is to debug features related to Persistent Stores API.
A common need for using a PostGIS database is to debug features related to Persistent Stores API or to better simulate a production environment. The following steps will guide you through setting up Tethys Platform to use a PostGIS database running in a Docker container.

.. warning::

Expand Down
308 changes: 226 additions & 82 deletions docs/contribute/code/testing.rst

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/tethys_sdk/extensions/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Extensions are not able to be linked to databases, but they can be used to store
id = Column(Integer, autoincrement=True, primary_key=True)
name = Column(String)
description = Column(String)
date_created = Column(DateTime, default=datetime.datetime.utcnow)
date_created = Column(DateTime, default=datetime.datetime.now(datetime.UTC))


To initialize the tables using a model defined in an extension, import the declarative base from the extension in the initializer function for the persistent store database you'd like to initialize:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ This example is adapted from the `Siphon NCSS Time Series Example <https://unida

# Construct a query at a location specified by the latitude and longitude and time range
# and return it in the NetCDF4 format
now = datetime.utcnow()
now = datetime.datetime.now(datetime.UTC)
query.lonlat_point(-105, 40).time_range(now, now + timedelta(days=7))
query.variables('streamflow').accept('netcdf')

Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/thredds/plot_at_location.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ In this step you will create a new controller that will query the dataset at the
geometry(geojson): A geojson object representing the location.
dataset(str): Name of the dataset to query.
variable(str): Name of the variable to query.
start_time(datetime): Start of time range to query. Defaults to datetime.utcnow().
start_time(datetime): Start of time range to query. Defaults to datetime.datetime.now(datetime.UTC).
end_time(datetime): End of time range to query. Defaults to 7 days after start_time.
vertical_level(number): The vertical level to query. Defaults to 100000.

Expand All @@ -215,7 +215,7 @@ In this step you will create a new controller that will query the dataset at the

# Filter by time
if start_time is None:
start_time = datetime.utcnow()
start_time = datetime.datetime.now(datetime.UTC)

if end_time is None:
end_time = start_time + timedelta(days=7)
Expand Down
24 changes: 23 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ dependencies = [
"django-guardian",
]

[project.optional-dependencies]
test = ["pytest", "pytest-django", "pytest-cov", "requests_mock"]
lint = ["flake8", "black"]

[project.urls]
homepage = "http://tethysplatform.org/"
documentation = "http://docs.tethysplatform.org/en/stable/"
Expand All @@ -60,4 +64,22 @@ local_scheme = "no-local-version"
include = ["tethys_*"]

[tool.setuptools]
package-data = {"*" = ["*"]}
package-data = {"*" = ["*"]}

[tool.pytest.ini_options]
DJANGO_SETTINGS_MODULE = "tethys_portal.settings"
addopts = "-s --cov"
testpaths = ["tests/unit_tests/"]

[tool.coverage.run]
omit = [
"docs/*",
"tests/*",
"tethys_portal/_version.py",
"tethys_portal/__init__.py",
"*/migrations/*",
]

[tool.coverage.report]
show_missing = true
skip_covered = true
Loading