Skip to content

Commit

Permalink
Add nox integration-tests session
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckwondo committed Sep 22, 2024
1 parent 7d50892 commit 9fea543
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
23 changes: 16 additions & 7 deletions docs/contributing/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,29 @@ If you don't have pipx (pip for applications), then you can install with
pip is reasonable). If you use macOS, then pipx and nox are both in brew, use
`brew install pipx nox`.

To use, run `nox`. This will typecheck and test using every installed version of
Python on your system, skipping ones that are not installed. You can also run
specific jobs:
To use, run `nox` without any arguments. This will run type checks and unit
tests using the installed version of Python on your system.

You can also run individual tasks (_sessions_ in `nox` parlance, hence the `-s`
option below), like so:

```console
$ nox -s typecheck # Typecheck only
$ nox -s tests # Python tests
$ nox -s build_docs -- --serve # Build and serve the docs
$ nox -s build_pkg # Make an SDist and wheel
nox -s typecheck # Run typechecks
nox -s tests # Run unit tests
nox -s integration-tests # Run integration tests (see note below)
nox -s build_docs -- --serve # Build and serve the docs
nox -s build_pkg # Build an SDist and wheel
```

Nox handles everything for you, including setting up a temporary virtual
environment for each run.

**NOTE:** In order to run integration tests locally, you must set the
environment variables `EARTHDATA_USERNAME` and `EARTHDATA_PASSWORD` to your
username and password, respectively, of your
[NASA Earthdata](https://urs.earthdata.nasa.gov/) account (registration is
free).

## Manual development environment setup

While `nox` is the fastest way to get started, you will likely need a full
Expand Down
16 changes: 16 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
import shutil
from pathlib import Path

Expand All @@ -26,6 +27,21 @@ def tests(session: nox.Session) -> None:
session.run("pytest", "tests/unit", *session.posargs)


@nox.session(name="integration-tests")
def integration_tests(session: nox.Session) -> None:
"""Run the integration tests."""
session.install("--editable", ".[test]")
session.run(
"scripts/integration-test.sh",
*session.posargs,
env=dict(
EARTHDATA_USERNAME=os.environ["EARTHDATA_USERNAME"],
EARTHDATA_PASSWORD=os.environ["EARTHDATA_PASSWORD"],
),
external=True,
)


@nox.session
def build_pkg(session: nox.Session) -> None:
"""Build a source distribution and binary distribution (wheel)."""
Expand Down

0 comments on commit 9fea543

Please sign in to comment.