Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] Enable psycopg v3 tests #685

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

kwongtn
Copy link
Contributor

@kwongtn kwongtn commented Jan 2, 2025

Description

Merge the following first:

P.s. Not sure if putting like 50 test scenarios is a good idea though 😅

Also I was thinking -- are we even using postgres in tests? 🤔

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Documentation

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

Summary by Sourcery

Tests:

  • Add tests for psycopg v3 compatibility.

Copy link
Contributor

sourcery-ai bot commented Jan 2, 2025

Reviewer's Guide by Sourcery

This PR enables tests for psycopg v3, expands Django and Python version support, and migrates from django-mptt to django-tree-queries.

Class diagram showing tree structure migration

classDiagram
    note for TreeNode "Replaces MPTT implementation"
    class TreeNode {
        +parent: TreeNode
        +children: List[TreeNode]
        +depth: int
        +path: str
    }
    TreeNode --> TreeNode: parent
    note for ArrayField "Now supports both psycopg2 and psycopg3"
    class ArrayField {
        +base_field
        +size: Optional[int]
        +default: Any
    }
Loading

File-Level Changes

Change Details Files
Enable psycopg v3 tests
  • Added "psycopg" to the test matrix, enabling tests with psycopg v3.
  • Added installation steps for both psycopg and psycopg-binary packages within the test workflow.
.github/workflows/tests.yml
Expand Django and Python version support
  • Added Django 5.1 to the test matrix.
  • Included Python 3.8 and Django 4.2 combination in the test matrix.
  • Adjusted exclusions to reflect the supported Python versions for each Django version (e.g., Django 4.2 with Python 3.13, Django 5.0 with Python 3.9 and 3.13, Django 5.1 with Python 3.9).
.github/workflows/tests.yml
Migrate from django-mptt to django-tree-queries
  • Replaced django-mptt with django-tree-queries in pyproject.toml.
  • Updated imports and model definitions to use django-tree-queries instead of django-mptt.
  • Renamed MPTT-related classes and files to TreeNode.
  • Updated tests to reflect the changes in models and imports.
  • Created new TreeNode-related files and tests.
  • Removed MPTT-related files and tests.
pyproject.toml
tests/relay/mptt/test_nested_children.py
tests/relay/treenode/test_nested_children.py
tests/relay/mptt/models.py
tests/relay/treenode/models.py
tests/relay/mptt/test_lazy_annotations.py
tests/relay/treenode/test_lazy_annotations.py
tests/relay/treenode/b.py
tests/relay/treenode/a.py
tests/relay/mptt/a.py
tests/relay/mptt/b.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.17%. Comparing base (48b54fd) to head (d13d70c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #685   +/-   ##
=======================================
  Coverage   89.17%   89.17%           
=======================================
  Files          41       41           
  Lines        3778     3778           
=======================================
  Hits         3369     3369           
  Misses        409      409           

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

Signed-off-by: Kwong Tung Nan <[email protected]>
@bellini666
Copy link
Member

@kwongtn now you can rebase this 😊

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.

3 participants