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

Do not assume active DB when not specified #210

Merged
merged 14 commits into from
Nov 26, 2022
Merged

Do not assume active DB when not specified #210

merged 14 commits into from
Nov 26, 2022

Conversation

VaZark
Copy link
Contributor

@VaZark VaZark commented Nov 22, 2022

Related to #208

Let Django decide the current DB when not specified in the function call.

  • Test with DB Router

@codecov
Copy link

codecov bot commented Nov 22, 2022

Codecov Report

Base: 95.58% // Head: 95.58% // No change to project coverage 👍

Coverage data is based on head (bc95b3c) compared to base (18f865b).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #210   +/-   ##
=======================================
  Coverage   95.58%   95.58%           
=======================================
  Files          36       36           
  Lines         408      408           
=======================================
  Hits          390      390           
  Misses         18       18           
Flag Coverage Δ
unittests 95.58% <100.00%> (ø)

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

Impacted Files Coverage Δ
admin_interface/models.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Owner

@fabiocaccamo fabiocaccamo left a comment

Choose a reason for hiding this comment

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

Could you add also a test case?

@VaZark
Copy link
Contributor Author

VaZark commented Nov 23, 2022

Could you add also a test case?

Yup. Just added a testcase with a DB Router

tests/test_multidb.py Outdated Show resolved Hide resolved
Copy link
Owner

@fabiocaccamo fabiocaccamo left a comment

Choose a reason for hiding this comment

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

  • Should run pre-commit run -a before commit files.
  • Tests are broken with older Python / Django versions.

tests/test_multidb.py Outdated Show resolved Hide resolved
@fabiocaccamo
Copy link
Owner

@VaZark could you fix tests?

@VaZark
Copy link
Contributor Author

VaZark commented Nov 25, 2022

Older versions of Django (<2.0) aren't throwing an exception when hitting a non-specified DB in a test case

class AdminInterfaceModelsWithDBRoutingTestCase(TestCase):
         databases = ["replica"]

Are you aware if there exists a different parameter to be used to specify active DB in older versions of Django ??

Or a way to skip the test for django < 2.0 ?

@merwok
Copy link
Contributor

merwok commented Nov 25, 2022

I always forget that this project supports ancient versions of Django!

https://www.djangoproject.com/download/#supported-versions

@fabiocaccamo
Copy link
Owner

@VaZark you can skip the test using unittest.skipIf decorator:
https://docs.python.org/3/library/unittest.html?highlight=skip#unittest.skip

@merwok it's already my intention to drop support for django versions < 2.2.

@VaZark
Copy link
Contributor Author

VaZark commented Nov 25, 2022 via email

@fabiocaccamo fabiocaccamo merged commit 23511d0 into fabiocaccamo:master Nov 26, 2022
@VaZark VaZark deleted the respect-dbrouter branch November 28, 2022 12:59
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