Clone the repository and install it:
cd astrostash
pip install -e ".[dev]"For PostgreSQL support, include the postgres extra:
pip install -e ".[dev,postgres]"By default, pytest runs only local unit tests (excluding remote, postgres,
and schema validation tests).
To run specific test groups:
# PostgreSQL integration tests (requires a running PostgreSQL instance)
pytest -m postgres -v
# Remote HEASARC tests (requires network access)
pytest -m remote -v
# Schema validation tests
pytest -m table_schemas -vNote: The
table_schemastests only validate which HEASARC catalogs are queryable. If this needs to be run, it will only be manually. In reality you will never need to run these tests. They were created for determining what catalogs (if any) don't work with astrostash.
Start a local PostgreSQL instance using Docker:
docker-compose up -dThis starts PostgreSQL 16 with the following defaults:
| Variable | Value |
|---|---|
ASTROSTASH_PGHOST |
127.0.0.1 |
ASTROSTASH_PGPORT |
5432 |
ASTROSTASH_PGDATABASE |
astrostash_test |
ASTROSTASH_PGUSER |
astrostash |
ASTROSTASH_PGPASSWORD |
astrostash_test |
Override any of these by setting the environment variables before running tests. When done:
docker-compose downNote: CI uses
astrostash_cias the password instead ofastrostash_test.
The CI pipeline runs on push to master and pull requests to master.
It consists of two jobs:
-
build : Lints with flake8 and runs local unit tests across Python 3.10, 3.11, 3.12, and 3.13.
-
test-postgres : Runs after
buildpasses. Tests against PostgreSQL 16 and 17 across the same Python version matrix.