Skip to content

fix: declare pytest-mock as dev dependency instead of installing ad hoc in CI#155

Merged
advaitpatel merged 4 commits into
OWASP:mainfrom
ShrijalDubey:fix/pytest-mock-dependency
Jul 23, 2026
Merged

fix: declare pytest-mock as dev dependency instead of installing ad hoc in CI#155
advaitpatel merged 4 commits into
OWASP:mainfrom
ShrijalDubey:fix/pytest-mock-dependency

Conversation

@ShrijalDubey

@ShrijalDubey ShrijalDubey commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Description

Declares pytest-mock (and other dev/test tools) as a proper package extra instead of installing them ad hoc in CI workflows. On a fresh clone, following the documented setup (pip install -e . + pip install -r requirements.txt) left pytest-mock missing, causing tests/test_compose_scanner.py::test_compose_orchestrator_offline to fail with fixture 'mocker' not found. CI didn't catch this because both workflows separately ran pip install pytest pytest-mock inline, so the dependency was declared nowhere central.

Implementation follows the approach suggested by @rksharma-owg in the issue thread (extras_require in setup.py + CONTRIBUTING.md and workflow updates to match).

Closes #153

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Code style update (formatting, renaming)
  • Code refactoring (no functional changes)
  • Performance improvement
  • Test update
  • Build / CI configuration
  • Security fix

How Has This Been Tested?

  • Unit tests
  • Manual testing

Reproduced the bug on a fresh clone (fresh venv → pip install -e .pip install -r requirements.txtpytest tests/ → 1 error, fixture not found). Installed pytest-mock manually to confirm it fixed the failure (184 passed). Then applied the actual fix (extras_require["dev"] in setup.py + updated CONTRIBUTING.md + both workflows to use pip install -e ".[dev]") and re-ran pytest tests/ from a fresh install — 184 passed, 0 errors.

Test Configuration:

  • Python version: 3.13.7
  • Operating System: Windows
  • DockSec version: 2026.7.3

Checklist

  • Code follows the style guidelines of this project
  • Self-review completed
  • Hard-to-understand areas are commented
  • Documentation updated where needed
  • No new warnings or errors introduced
  • Tests added that prove the fix or feature works
  • All existing tests pass
  • Dependent changes have been merged and published
  • Spelling checked

Related Issues / PRs


By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@github-actions github-actions Bot added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file ci Changes to CI/CD workflows labels Jul 14, 2026
@codecov-commenter

codecov-commenter commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.26%. Comparing base (a2fe184) to head (a349eaf).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #155      +/-   ##
==========================================
+ Coverage   78.95%   79.26%   +0.30%     
==========================================
  Files          26       30       +4     
  Lines        4158     4557     +399     
==========================================
+ Hits         3283     3612     +329     
- Misses        875      945      +70     
Flag Coverage Δ
unittests 79.26% <ø> (+0.30%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@advaitpatel

Copy link
Copy Markdown
Collaborator

@ShrijalDubey thank you for the PR. Can you please update your branch and resolve the conflict with setup.py. Let me know once done, I will review it.

@advaitpatel
advaitpatel self-requested a review July 18, 2026 00:19
@ShrijalDubey

ShrijalDubey commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Hi @advaitpatel, thanks for the review! I've updated the branch and resolved the conflict in setup.py.

@advaitpatel advaitpatel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm, thank you for your contributions.

@advaitpatel
advaitpatel merged commit ed9fdd1 into OWASP:main Jul 23, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Changes to CI/CD workflows dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test suite can't run on a fresh clone: pytest-mock is used but never declared

3 participants