Skip to content

Introduce foundation for unit tests (pytest + Zuul CI)#2193

Merged
ideaship merged 1 commit intomainfrom
gh2192
Apr 24, 2026
Merged

Introduce foundation for unit tests (pytest + Zuul CI)#2193
ideaship merged 1 commit intomainfrom
gh2192

Conversation

@berendt
Copy link
Copy Markdown
Member

@berendt berendt commented Apr 24, 2026

Set up the minimal infrastructure so unit tests can be added in follow-up issues. Covers #2192.

  • Add [dev-packages] in Pipfile: pytest, pytest-cov, pytest-mock
  • Create tests/ layout with a smoke test asserting osism is importable and exposes version
  • Configure pytest via [tool:pytest] in setup.cfg
  • Add playbooks/test-unit.yml and a new python-osism-unit-tests Zuul job wired into the check and periodic-daily pipelines; the existing python-osism-test-setup job is kept in parallel (replace decision left to review per the issue)
  • Document local test execution in README.md

Closes #2192

AI-assisted: Claude Code

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="tests/unit/test_smoke.py" line_range="10-11" />
<code_context>
+    assert osism is not None
+
+
+def test_package_has_version_attribute():
+    assert hasattr(osism, "__version__")
</code_context>
<issue_to_address>
**suggestion (testing):** Extend the version smoke test to validate the value of `__version__`, not only its presence.

`hasattr(osism, "__version__")` would still pass if `__version__` were `None` or an unexpected type. To make the test more robust, also assert that it is a non-empty string, for example:

```python
assert isinstance(osism.__version__, str)
assert osism.__version__
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread tests/unit/test_smoke.py
Copy link
Copy Markdown
Contributor

@ideaship ideaship left a comment

Choose a reason for hiding this comment

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

According to setup.cfg, this repo supports python>=3.8, but with this change, that is no longer true. You'd have to lift it to 3.10. The only current OS that ships an older python (that I know of) is macOS which ships 3.9.6.

@berendt
Copy link
Copy Markdown
Member Author

berendt commented Apr 24, 2026

According to setup.cfg, this repo supports python>=3.8, but with this change, that is no longer true. You'd have to lift it to 3.10. The only current OS that ships an older python (that I know of) is macOS which ships 3.9.6.

That's fine. We use Python >= 3.10 in all container images where we want to use it. For local tests I think that's also fine. At least it's pretty simple to use Python >= 3.10 on MacOS.

Set up the minimal infrastructure so unit tests can be added in
follow-up issues. Covers #2192.

- Add [dev-packages] in Pipfile: pytest, pytest-cov, pytest-mock
- Create tests/ layout with a smoke test asserting osism is importable
  and exposes __version__
- Configure pytest via [tool:pytest] in setup.cfg
- Raise minimum Python to 3.10 (python_requires and classifiers in
  setup.cfg) so tests and code can rely on modern language features
- Add playbooks/test-unit.yml and a new python-osism-unit-tests Zuul
  job wired into the check and periodic-daily pipelines; the existing
  python-osism-test-setup job is kept in parallel (replace decision
  left to review per the issue)
- Document local test execution in README.md

Closes #2192

AI-assisted: Claude Code

Signed-off-by: Christian Berendt <berendt@osism.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce foundation for unit tests (pytest + Zuul CI integration)

2 participants