pytest support library for SAS testing with saspy
Project description
saspytest
pytest support library for SAS testing with saspy.
saspytest provides utility functions and pytest-style assertions for testing SAS programs through the saspy Python interface. It is inspired by SASUnit assertion macros.
Features
- Session management – Shared or isolated SAS sessions with automatic setup and teardown
- Log assertions – Validate SAS logs for errors, warnings, or custom patterns
- Dataset assertions – Check dataset existence, record counts, columns, and equality
- Macro assertions – Verify SAS macro variable values and existence
- File utilities – Upload/download files and submit local
.sasscripts
Installation
pip install saspytest
Prerequisites
- Python 3.11+
- A working saspy configuration that can connect to your SAS deployment
- Java (required by saspy for IOM connections)
Note: saspytest does not bundle proprietary SAS JARs. You must provide your own SAS deployment and configure saspy accordingly (e.g.
sascfg_personal.pyor environment variables).
Testing
- Unit tests, no live SAS required:
pytest -c pytest.unit.ini - Integration tests, live SAS required:
pytest tests/integration/ -v
The unit-test config disables the saspytest plugin so pytest does not try to open a SAS session during local mock-based runs.
Quickstart
When saspytest is installed, pytest auto-loads the package's fixture plugin, so
the sas_session fixture is available in your tests without importing it.
from saspytest import (
assert_no_errors,
assert_dataset_exists,
assert_record_count,
)
def test_sas_program(sas_session):
result = sas_session.submit("""
data work.SASPYTEST_EXAMPLE;
do i = 1 to 5;
output;
end;
run;
""")
assert_no_errors(result["LOG"])
assert_dataset_exists(sas_session, "SASPYTEST_EXAMPLE")
assert_record_count(sas_session, "SASPYTEST_EXAMPLE", 5)
Documentation
- User Guide – How to use saspytest: session management, assertions, file utilities, and examples
- API Reference – Complete function and fixture reference
- Development Setup – Getting started as a contributor
- Development Guidelines – Code style and conventions
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file saspytest-0.1.4.tar.gz.
File metadata
- Download URL: saspytest-0.1.4.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8949d2fdb3684aafbade8b6f7208f71a2c6d1b22bd66973949ca168569a3582
|
|
| MD5 |
452e430d0e9a0da1e2fddeced18222b3
|
|
| BLAKE2b-256 |
0f43299c32c431581bfa14d0db525b1363e35af03950463c7bb8e4e8d7ca70cb
|
Provenance
The following attestation bundles were made for saspytest-0.1.4.tar.gz:
Publisher:
release.yml on awesome-sas/saspytest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
saspytest-0.1.4.tar.gz -
Subject digest:
c8949d2fdb3684aafbade8b6f7208f71a2c6d1b22bd66973949ca168569a3582 - Sigstore transparency entry: 1547026949
- Sigstore integration time:
-
Permalink:
awesome-sas/saspytest@9dee3e50f7675e0f4c0c1824c063172e156e010d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/awesome-sas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9dee3e50f7675e0f4c0c1824c063172e156e010d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file saspytest-0.1.4-py3-none-any.whl.
File metadata
- Download URL: saspytest-0.1.4-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69ad8c07b124bc99c5a076f5cc6abcb905c1418cdd842132fcc6a5171046e00b
|
|
| MD5 |
175eea2b4f6406a0e5e6c4eb26baa63f
|
|
| BLAKE2b-256 |
716524273d350453e158e26e06538fa236a7e324acf75b2b5d74fa579a03808a
|
Provenance
The following attestation bundles were made for saspytest-0.1.4-py3-none-any.whl:
Publisher:
release.yml on awesome-sas/saspytest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
saspytest-0.1.4-py3-none-any.whl -
Subject digest:
69ad8c07b124bc99c5a076f5cc6abcb905c1418cdd842132fcc6a5171046e00b - Sigstore transparency entry: 1547026955
- Sigstore integration time:
-
Permalink:
awesome-sas/saspytest@9dee3e50f7675e0f4c0c1824c063172e156e010d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/awesome-sas
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9dee3e50f7675e0f4c0c1824c063172e156e010d -
Trigger Event:
workflow_dispatch
-
Statement type: