Metadata-Version: 2.4
Name: saspytest
Version: 0.1.2
Summary: pytest support library for SAS testing with saspy
Project-URL: Homepage, https://github.com/awesome-sas/saspytest
Project-URL: Bug Reports, https://github.com/awesome-sas/saspytest/issues
Project-URL: Source, https://github.com/awesome-sas/saspytest
Author: Andreas Menrath
License-Expression: MIT
License-File: LICENSE
Keywords: assertions,pytest,sas,saspy,testing,unittest
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.9
Requires-Dist: pandas>=3.0.0
Requires-Dist: pytest>=6.0.0
Requires-Dist: saspy>=5.0.0
Provides-Extra: dev
Requires-Dist: black; extra == 'dev'
Requires-Dist: flake8; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pylint; extra == 'dev'
Requires-Dist: pytest-mock; extra == 'dev'
Requires-Dist: pytest>=6.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# saspytest

**pytest support library for SAS testing with saspy.**

saspytest provides utility functions and pytest-style assertions for testing SAS programs through the [saspy](https://saspy.readthedocs.io/) 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 `.sas` scripts

---

## Installation

```bash
pip install saspytest
```

### Prerequisites

- Python 3.9+
- A working [saspy](https://saspy.readthedocs.io/) 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.py` or environment variables).

---

## Quickstart

```python
from saspytest import (
    assert_no_errors,
    assert_dataset_exists,
    assert_record_count,
)

def test_sas_program(sas_session):
    result = sas_session.submit("""
        data test;
            do i = 1 to 5;
                output;
            end;
        run;
    """)

    assert_no_errors(result["LOG"])
    assert_dataset_exists(sas_session, "test")
    assert_record_count(sas_session, "test", 5)
```

---

## Documentation

- Full API reference: see `docs/API_REFERENCE.md`
- Development guidelines: see `docs/DEVELOPMENT_GUIDELINES.md`

---

## License

MIT License. See `LICENSE` for details.
