discord-modmail / modmail

A Modmail bot for Discord. Allowing safe moderator conversations with server members one server at a time.
https://discord-modmail.readthedocs.io/
MIT License
15 stars 8 forks source link

tests: fix environment not being replaced soon enough #126

Closed onerandomusername closed 2 years ago

onerandomusername commented 2 years ago

continuation of #120

That solution using a fixture did not patch the environment soon enough. This will patch the environment and save a cache of the original environment, so it can replaced upon the end of a test run.

codecov[bot] commented 2 years ago

Codecov Report

Merging #126 (67d19f5) into main (4b07917) will decrease coverage by 0.38%. The diff coverage is 47.36%.

:exclamation: Current head 67d19f5 differs from pull request most recent head f503ae6. Consider uploading reports for the commit f503ae6 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #126      +/-   ##
==========================================
- Coverage   70.90%   70.52%   -0.39%     
==========================================
  Files          33       33              
  Lines        1619     1632      +13     
  Branches      199      203       +4     
==========================================
+ Hits         1148     1151       +3     
- Misses        439      447       +8     
- Partials       32       34       +2     
Impacted Files Coverage Δ
tests/modmail/conftest.py 63.88% <47.36%> (-23.07%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8ba34ba...f503ae6. Read the comment docs.

onerandomusername commented 2 years ago

After further inspection, this should keep the environment unmodified, only removing all variables prefixed with MODMAIL_ in order to keep the environment more realistic of what would happen on a real environment, and only controlling the program specific environment variables.

onerandomusername commented 2 years ago

However, environment variables are currently not prefixed with MODMAIL_, as that is introduced in #75.

onerandomusername commented 2 years ago

This can be reviewed and merged, but will only have an effect on the testing environment once GH-75 is merged

onerandomusername commented 2 years ago

Merging main to get the updated workflows here.

Will rebase before merge.

coveralls commented 2 years ago

Coverage Status

Coverage decreased (-0.05%) to 72.981% when pulling f503ae6a83d210babc71f29b5661938af4968c6c on tests/fix-environment into 8ba34baf8d64258d9ec0dbd41d8e17d7e86dc8bb on main.