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

Use a TypedDict for plugin options config - closes #706 #724

Merged
merged 2 commits into from
Apr 19, 2023

Conversation

jaredkeil
Copy link
Contributor

@jaredkeil jaredkeil commented Apr 16, 2023

Implemented PostgresqlConfigDict(TypedDict) which has the same keys as the previous config dict. The value types are what is expected from the request.config object after .ini or command line options are parsed, and in general fit the expected usages of config["<some_option>"]. Now, when a variable is set by getting a config value, there is a type hint for that variable. For example:

config = get_config(request)
port = config["port"]
# type hint -- port: str | None

@codecov-commenter
Copy link

codecov-commenter commented Apr 17, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.09 🎉

Comparison is base (d3c3ba1) 94.27% compared to head (043cfc1) 94.37%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #724      +/-   ##
==========================================
+ Coverage   94.27%   94.37%   +0.09%     
==========================================
  Files          22       22              
  Lines         629      640      +11     
==========================================
+ Hits          593      604      +11     
  Misses         36       36              
Flag Coverage Δ
linux 66.71% <100.00%> (+0.58%) ⬆️
macos 90.00% <100.00%> (+0.17%) ⬆️

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

Impacted Files Coverage Δ
pytest_postgresql/config.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 in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@fizyk
Copy link
Collaborator

fizyk commented Apr 17, 2023

@jaredkeil tests fail on python 3.7:

  • remove python 3.7 from the CI/package definition, and require at least 3.8
  • Add newsfragments (break for dropping python 3.7 support and misc for introducing Typed config dict)
  • adjust typing according to mypy issues

@fizyk
Copy link
Collaborator

fizyk commented Apr 17, 2023

Add newsfragment pipenv run towncrier create [issue_number].[type].rst

@jaredkeil
Copy link
Contributor Author

Summary of changes which now pass the checks:

  • Removed 3.7 from the workflow "Run tests" python-version matrix
  • Updated setup.cfg python_requires at least 3.8, removed Python 3.7 lang from classifiers
  • Resolved mypy issues by updating config types and return type of get_postgresql_option
  • Resolved black issue by adding trailing comma to PostgresqlConfigDict instantiation args
  • Changed raw list type of config["load"] to List for older python version
  • Added 2 newsfragments, one for break, one for misc, each linked to original issue Review typing #706.

@fizyk
Copy link
Collaborator

fizyk commented Apr 19, 2023

Thank you @jaredkeil

@fizyk fizyk merged commit 2efb84e into dbfixtures:main Apr 19, 2023
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