Metadata-Version: 2.4
Name: pytest-auto-param-fixtures
Version: 0.1.0
Summary: Pytest plugin to auto generate parameter fixtures for your pytests
Author-email: Sam Rickard <60978083+pseudofred@users.noreply.github.com>
License: MIT License
        
        Copyright (c) 2026 Sam Rickard (pseudofred)
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PyYAML
Dynamic: license-file

# Auto‑Fixture Plugin
Generate pytest fixtures automatically from `params.yaml` files.

* Each test directory may contain a `params.yaml`.
* Every top‑level key becomes a fixture.
* Fixtures only apply to tests in the same directory and its subdirectories.

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

## Auto Fixture Definitions

### Example `tests/params.yaml`

```yaml
# Values
timeout: 30
env: "staging"

# Lists
ids: [1, 2, 3]
priority: ["medium", "low"]
scores: [22, 7, 64]
tags: ["a", "b"]

# Dictionaries
numbers:
  type: ["int", "float"]
  example: ["123", "4.56"]

# Mode: product (cartesian product)
pets:
  _mode: product
  animal: ["cat", "dog"]
  name: ["alice", "bob"]

# Mode: zip (pairs items position-wise)
login:
  _mode: zip
  username: ["alice", "bob"]
  password: ["123", "456"]

```
### Example `tests/other/params.yaml`
```yaml
# Merge: append, true
ids:
  _merge: append
  values: [4, 5, 6]

# Merge: prepend
priority:
  _merge: prepend
  values: ["critical", "high"]

# Merge: sort, sorted
scores:
  _merge: sort
  values: [40, 26, 83]

# Merge: unique
tags:
  _merge: unique
  values: ["b", "c"]
```

## Resulting Fixtures
### Fixtures available in `tests/`
```python
timeout = 30
env = "staging"

ids = [1, 2, 3]
priority = ["medium", "low"]
scores = [22, 7, 64]
tags = ["a", "b"]

numbers = {
  "type": ["int", "float"],
  "example": ["123", "4.56"],
}

pets = [
    {"animal": "cat", "name": "alice"},
    {"animal": "cat", "name": "bob"  },
    {"animal": "dog", "name": "alice"},
    {"animal": "dog", "name": "bob"  },
]

login = [
    {"username": "alice", "password": "123"},
    {"username": "bob",   "password": "456"},
]
```
### Fixtures available in `tests/other/`
```python
timeout = 30
env = "staging"

ids = [1, 2, 3, 4, 5, 6]
priority = ["critical", "high", "medium", "low"]
scores = [7, 22, 26, 40, 64, 83]
tags = ["a", "b", "c"]

numbers = {
  "type": ["int", "float"],
  "example": ["123", "4.56"],
}

pets = [
    {"animal": "cat", "name": "alice"},
    {"animal": "cat", "name": "bob"  },
    {"animal": "dog", "name": "alice"},
    {"animal": "dog", "name": "bob"  },
]

login = [
    {"username": "alice", "password": "123"},
    {"username": "bob",   "password": "456"},
]
```

## Directory Scoping
Fixtures defined in `tests/foo_tests/params.yaml` are available to `foo_tests/` and any subfolders.

## Example Test Directory Structure
```
tests/
  test_foo.py
  other/
    test_bar.py
    params.yaml
  params.yaml
```

Fixtures in `tests/params.yaml` apply to `tests/` and `tests/other/`.

Fixtures in `tests/other/params.yaml` override or merge with `tests/params.yaml` and apply only to `tests/other/`.

## License
This project is licensed under the MIT License. See the LICENSE file for details.
