Skip to content

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

Open
ShrijalDubey wants to merge 2 commits into
OWASP:mainfrom
ShrijalDubey:fix/pytest-mock-dependency
Open

fix: declare pytest-mock as dev dependency instead of installing ad hoc in CI#155
ShrijalDubey wants to merge 2 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

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@8abff6c). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #155   +/-   ##
=======================================
  Coverage        ?   78.95%           
=======================================
  Files           ?       26           
  Lines           ?     4158           
  Branches        ?        0           
=======================================
  Hits            ?     3283           
  Misses          ?      875           
  Partials        ?        0           
Flag Coverage Δ
unittests 78.95% <ø> (?)

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.

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

2 participants