Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions .github/QUICK_START.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,42 +37,38 @@ jobs:
- uses: actions/checkout@v4
- uses: thoughtparametersllc/python-testing@v1
with:
generate-badges: 'true'
update-readme: 'true'
commit-badges: 'true'
```

Badges will automatically appear in your README! 🏷️
Then add badge to your README manually:

```markdown
![Pytest](.github/badges/pytest.svg)
```

## 3. With Custom Options (10 minutes)

Add framework-specific options:
Add pytest-specific options:

```yaml
- uses: thoughtparametersllc/python-testing@v1
with:
python-version: '3.11'
requirements-file: 'requirements.txt'
pytest-options: '--cov --cov-report=xml'
behave-options: '--format=progress'
```

## What Happens Automatically?

✅ Detects your testing frameworks
✅ Installs necessary dependencies
✅ Runs all detected tests
✅ Installs pytest
✅ Installs your requirements
✅ Runs pytest tests
✅ Generates detailed reports
✅ Creates status badges (if enabled)
✅ Updates README (if enabled)

## Supported Frameworks
## Supported Framework

- **pytest** - Most popular Python testing framework
- **unittest** - Built-in Python testing
- **nose2** - Enhanced testing
- **behave** - BDD/Cucumber-style testing
- **tox** - Multi-environment testing
- **doctest** - Documentation testing

## Next Steps

Expand Down
140 changes: 11 additions & 129 deletions .github/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,13 @@ jobs:

That's it! The action will automatically detect and run your testing frameworks.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Change this line because this action does't not automatically detect and run your testing frameworks but assumes you have pytest setup in your code in the directory structure.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 7635657. Changed line 30 from "The action will automatically detect and run your testing frameworks" to "The action will install pytest and run your tests".

Also updated similar misleading language in:

  • README.md: Changed description from "automatically detect and run Python testing frameworks" to "run Python tests using pytest"
  • IMPLEMENTATION_SUMMARY.md: Completely revised to accurately reflect pytest-only implementation


## Framework Detection
## Testing Framework

The action automatically detects which testing frameworks your project uses:
This action runs pytest for your Python tests.

### pytest

Detected if any of these exist:
- `pytest.ini` file
- `pyproject.toml` file
- `setup.cfg` file
- `import pytest` in any Python file
The action installs and runs pytest with your specified options.

**Example configuration:**
```yaml
Expand All @@ -48,61 +44,6 @@ Detected if any of these exist:
pytest-options: '--cov=mypackage --cov-report=xml'
```

### unittest

Detected if:
- `import unittest` found in test files (test*.py or *test.py)

**Example configuration:**
```yaml
- uses: thoughtparametersllc/python-testing@v1
with:
unittest-options: '-v -s tests'
```

### nose2

Detected if any of these exist:
- `.noserc` file
- `nose.cfg` file
- `[nosetests]` section in `setup.cfg`

**Example configuration:**
```yaml
- uses: thoughtparametersllc/python-testing@v1
with:
nose-options: '--verbose --with-coverage'
```

### behave (BDD/Cucumber)

Detected if:
- `features/` directory exists with `.feature` files

**Example configuration:**
```yaml
- uses: thoughtparametersllc/python-testing@v1
with:
behave-options: '--format=progress --tags=@automated'
```

### tox

Detected if:
- `tox.ini` file exists

**Example configuration:**
```yaml
- uses: thoughtparametersllc/python-testing@v1
with:
tox-options: '-e py311,py312'
```

### doctest

Detected if:
- `>>>` patterns found in Python files (indicating docstring tests)

## Configuration Options

### Python Version
Expand All @@ -125,18 +66,14 @@ Install additional dependencies before running tests:
requirements-file: 'requirements-dev.txt'
```

### Framework-Specific Options
### pytest Options

Pass custom options to each testing framework:
Pass custom options to pytest:

```yaml
- uses: thoughtparametersllc/python-testing@v1
with:
pytest-options: '--cov --cov-report=xml --maxfail=1'
unittest-options: '-v -s tests'
nose-options: '--verbose --with-timer'
behave-options: '--tags=@smoke --format=pretty'
tox-options: '-e py311'
```

## Badge Generation
Expand All @@ -157,47 +94,18 @@ jobs:

- uses: thoughtparametersllc/python-testing@v1
with:
generate-badges: 'true'
commit-badges: 'true'
badges-directory: '.github/badges'
```

### Automatic README Updates

Automatically insert badge references in your README:

```yaml
- uses: thoughtparametersllc/python-testing@v1
with:
generate-badges: 'true'
update-readme: 'true'
readme-path: 'README.md'
badge-style: 'path' # or 'url'
```

### Badge Styles

Two badge styles are available:

1. **Relative Path** (`badge-style: 'path'`):
```markdown
![Pytest](.github/badges/pytest.svg)
```

2. **GitHub URL** (`badge-style: 'url'`):
```markdown
![Pytest](https://raw.githubusercontent.com/owner/repo/main/.github/badges/pytest.svg)
```

### Manual Badge Reference

If not using automatic README updates, add badges manually:
Add badges manually to your README:

```markdown
# My Project

![Pytest](.github/badges/pytest.svg)
![Unittest](.github/badges/unittest.svg)
![Behave](.github/badges/behave.svg)
```

## Advanced Usage
Expand Down Expand Up @@ -257,19 +165,9 @@ Generate coverage reports with pytest:
files: ./coverage.xml
```

### BDD Testing with Behave

Run specific feature tags:

```yaml
- uses: thoughtparametersllc/python-testing@v1
with:
behave-options: '--tags=@smoke,@critical --format=progress'
```

### Conditional Testing

Run different frameworks on different branches:
Run different options on different branches:

```yaml
- uses: thoughtparametersllc/python-testing@v1
Expand All @@ -279,15 +177,6 @@ Run different frameworks on different branches:

## Troubleshooting

### No Frameworks Detected

If no frameworks are detected:

1. Check that your test files are in the repository
2. Verify framework configuration files exist
3. Ensure test imports are present in your code
4. Review the detection summary in the Action output

### Badge Commit Failures

If badges aren't being committed:
Expand All @@ -302,9 +191,9 @@ If badges aren't being committed:

3. Verify the action has access to push to the repository

### Framework Installation Issues
### Installation Issues

If a framework fails to install:
If pytest or requirements fail to install:

1. Check that `requirements-file` path is correct
2. Verify your requirements file has correct syntax
Expand All @@ -318,26 +207,19 @@ To debug test failures:
1. Review the detailed output in the GitHub Actions summary
2. Run tests locally with the same options
3. Check for environment-specific issues (paths, dependencies)
4. Enable verbose output with framework options:
4. Enable verbose output:
```yaml
pytest-options: '--verbose --tb=long'
unittest-options: '-v'
```

### Custom Test Directories

If tests are in a non-standard location:

For pytest:
```yaml
pytest-options: 'path/to/tests/'
```

For unittest:
```yaml
unittest-options: '-s path/to/tests'
```

## Best Practices

1. **Use a requirements file**: Specify all test dependencies
Expand Down
23 changes: 23 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"default": true,
"MD013": {
"line_length": 120,
"heading_line_length": 120,
"code_block_line_length": 120,
"code_blocks": true,
"tables": false,
"headings": true,
"strict": false,
"stern": false
},
"MD033": {
"allowed_elements": ["br", "img", "svg", "path", "g", "text", "rect", "linearGradient", "stop", "clipPath"]
},
"MD024": {
"siblings_only": true
},
"MD041": false,
"MD046": {
"style": "fenced"
}
}
41 changes: 28 additions & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,39 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.0.1] - 2025-12-19
## [Unreleased]

## [1.0.0] - 2025-12-19
### Added

- SECURITY.md file with security policy and vulnerability reporting guidelines
- .markdownlint.json configuration file for consistent markdown formatting
- Comprehensive security best practices documentation

### Changed

- Updated README.md to accurately reflect actual action.yml inputs and functionality
- Updated USAGE.md to match current pytest-only implementation
- Updated QUICK_START.md to reflect actual badge generation workflow
- Fixed CONTRIBUTING.md references from "Python Linting Action" to "Python Testing Action"
- Fixed clone path in CONTRIBUTING.md from "python-linting" to "python-testing"
- Removed documentation for non-existent inputs: unittest-options, nose-options, behave-options,
tox-options, generate-badges, update-readme, readme-path, and badge-style
- Updated feature list to reflect pytest-only support
- Simplified framework detection section to reflect current implementation

### Fixed

- Documentation inconsistencies between action.yml and README.md
- Incorrect action name references in CONTRIBUTING.md

## [1.0.1] - 2025-12-19

## [Unreleased]
Initial release with pytest support

Copilot AI Dec 19, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version sections 1.0.1 and 1.0.0 both have the same description "Initial release with pytest support", which is inconsistent. Typically, 1.0.0 would be the initial release and 1.0.1 would be a patch release with specific changes. Consider either removing the duplicate entry or providing distinct descriptions for each version to clarify what differentiates 1.0.1 from 1.0.0.

Copilot uses AI. Check for mistakes.

### Added
## [1.0.0] - 2025-12-19

- Initial release of Python Testing Action
- Automatic detection of Python testing frameworks
- Support for pytest with configurable options
- SVG badge generation for each detected framework
- Detailed test results in GitHub Actions summary
- Support for custom requirements file installation
- Configurable Python version support
Initial release with pytest support

## [1.0.0] - TBD
## [0.0.1] - 2025-12-19

Initial release
Initial development release
Loading