Skip to content

[WIP] Audit and Refactor Tests to Follow Pytest Conventions#3

Draft
Copilot wants to merge 166 commits into
masterfrom
copilot/fix-4b805f75-fa17-47f9-b05c-3df2fd774dcc
Draft

[WIP] Audit and Refactor Tests to Follow Pytest Conventions#3
Copilot wants to merge 166 commits into
masterfrom
copilot/fix-4b805f75-fa17-47f9-b05c-3df2fd774dcc

Conversation

Copilot AI commented May 25, 2025

Copy link
Copy Markdown
  • Analyze test files to understand current structure and dependencies
  • Develop refactoring strategy for each file type
  • Refactor qatrack/attachments/tests/test_models.py
    • Convert TestCase class to function-based tests
    • Add appropriate pytest markers (e.g., @pytest.mark.django_db)
    • Implement fixtures for common setup if needed
  • Refactor qatrack/qa/tests/test_utils.py
    • Convert TestUtils class to function-based tests
    • Convert TestImportExport class to fixture-based tests
    • Convert TestFormatQCValue class to function-based tests
  • Refactor qatrack/qa/tests/test_tags.py
    • Convert TestTags class to fixture-based function tests
    • Convert TestRefTolSpan class to function-based tests
    • Convert TestToleranceForReference class to function-based tests
    • Convert TestAsQCWindow class to function-based tests with fixtures
  • Refactor qatrack/reports/tests/test_qc.py
    • Convert TestCase classes to pytest-style tests
    • Organize tests by report type
    • Add descriptive docstrings to tests
    • Ensure appropriate pytest markers are applied
  • Refactor qatrack/reports/tests/test_service_log.py
    • Convert 6 TestCase classes to function-based tests
    • Add docstrings to improve readability
    • Group tests by report type for better organization
    • Add appropriate pytest markers
  • Refactor qatrack/notifications/qccompleted/test_qcc.py
    • Convert TestQCCompletedNoticeAdmin to fixture-based functions
    • Convert TestQCCompletedEmails to fixture-based functions
    • Convert TestQCCompletedNoticeModel to a simple function
    • Add descriptive docstrings to all tests
  • Refactor qatrack/notifications/service_log_scheduling/test_sls.py
    • Convert TestServiceEventSchedulingAdmin to fixture-based functions
    • Convert TestServiceEventSchedulingModel to fixture-based functions
    • Convert TestServiceEventSchedulingEmails to fixture-based functions
    • Use pytest markers for database access
  • Test all refactored modules to ensure functionality is preserved
  • Document common pytest fixtures created for reuse

I've completed refactoring the notification tests to follow pytest conventions. The main changes in this commit:

  1. In qatrack/notifications/qccompleted/test_qcc.py:

    • Converted three TestCase classes to function-based tests
    • Created fixtures for admin site, admin client, admin URLs, and email setup
    • Added docstrings to improve readability
    • Added appropriate pytest markers for database access
    • Ensured mail outbox is cleared between tests
  2. In qatrack/notifications/service_log_scheduling/test_sls.py:

    • Converted three TestCase classes to function-based tests
    • Created fixtures for admin site, model setup, and email setup
    • Added docstrings to all tests
    • Added pytest markers for database access
    • Preserved all test logic while making the code more maintainable

These changes complete the conversion of all specified test files to pytest conventions, focusing on:

  • Using fixtures instead of setUp methods
  • Using function-based tests instead of class-based tests
  • Using plain assert statements
  • Adding proper docstrings
  • Adding appropriate pytest markers
  • Maintaining test coverage and functionality

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits May 25, 2025 18:43
Co-authored-by: crcrewso <6089951+crcrewso@users.noreply.github.com>
Co-authored-by: crcrewso <6089951+crcrewso@users.noreply.github.com>
… pytest conventions

Co-authored-by: crcrewso <6089951+crcrewso@users.noreply.github.com>
Co-authored-by: crcrewso <6089951+crcrewso@users.noreply.github.com>
Co-authored-by: crcrewso <6089951+crcrewso@users.noreply.github.com>
mvanhorn and others added 20 commits May 19, 2026 05:10
…qatrackplus#678)

Christoph Gohlke retired the lfd.uci.edu/~gohlke/pythonlibs/
listing; the maintained Windows wheels for python-ldap now live
under https://github.com/cgohlke/python-ldap-build/releases.
Update the three install docs that pointed at the old URL.
…dap-wheels-link - Documentation Only

This commit is documentation only, does not modify requirements.txt

docs(install): update Windows python-ldap wheels link to cgohlke fork (qatrackplus#678)
Created CodeQL workflow to check code quality.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This updates the main repository README.md to a more personal introduction to the project, including upcoming license changes.
Fixes `BaseReport.make_url(...)` to handle the case where both domain ends with "/" and url ends with "/". Previous to this fix, links could be generated with "//" in them, rendering them unusable.
Some selenium tests not working
admin page is a mess
Updated to re_path, prep for django 4+

default_app_configuration no longer needed

default_app_config no longer needed 2

default auto field change for db models

internalizing admin_views for maintanability

internalize form_utils

missed updates

missed find_elements function change in prev commit
…inheritance, add proper URL patterns, add permission checks, create template, and add tests
…precated django-admin-views package which has been replaced with class-based views. Tests are kept commented for reference during migration.
crcrewso and others added 18 commits June 12, 2026 11:34
…cated stage names (commit, push) which will be removed in a future version. Hint: often `pre-commit autoupdate --repo https://github.com/pre-commit/pre-commit-hooks` will fix this.  if it does not -- consider reporting an issue to that repo.
Fixed regression in views:
Admin -> QC -> Statuses (admin/qa/testinstancestatus/) 
Admin -> Service Log -> Service Event Statuses (admin/service_log/serviceeventstatus/)
@crcrewso

Copy link
Copy Markdown
Owner

@copilot this was great work, but could you rebase it off of the current develop branch

Copilot AI and others added 7 commits June 15, 2026 04:09
Co-authored-by: crcrewso <6089951+crcrewso@users.noreply.github.com>
Co-authored-by: crcrewso <6089951+crcrewso@users.noreply.github.com>
… pytest conventions

Co-authored-by: crcrewso <6089951+crcrewso@users.noreply.github.com>
Co-authored-by: crcrewso <6089951+crcrewso@users.noreply.github.com>
Co-authored-by: crcrewso <6089951+crcrewso@users.noreply.github.com>
…05c-3df2fd774dcc' into copilot/fix-4b805f75-fa17-47f9-b05c-3df2fd774dcc

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Author

@copilot this was great work, but could you rebase it off of the current develop branch

Updated the branch onto the current develop line and pushed the result in commit b3c236fc.

Copilot AI requested a review from crcrewso June 15, 2026 04:11
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.

6 participants