schireson / pytest-mock-resources

Pytest Fixtures that let you actually test against external resource (Postgres, Mongo, Redshift...) dependent code.
https://pytest-mock-resources.readthedocs.io/en/latest/quickstart.html
MIT License
179 stars 19 forks source link

fix: Move port selection into the filelock. #174

Closed DanCardin closed 1 year ago

DanCardin commented 1 year ago

This is primarily useful when port is set to None, leading to random port selction for the scope of fixture being used.

The expectation is that for tests not using this feature, the port selection is a simple lookup and therefore the lock contention will only apply 1 or (-n N) N times, such that the differnce to everyone else is negligible.

codecov[bot] commented 1 year ago

Codecov Report

Merging #174 (7ca60b5) into main (a28c490) will increase coverage by 3.75%. The diff coverage is 96.52%.

@@            Coverage Diff             @@
##             main     #174      +/-   ##
==========================================
+ Coverage   82.84%   86.60%   +3.75%     
==========================================
  Files          30       31       +1     
  Lines        1306     1396      +90     
  Branches      187      173      -14     
==========================================
+ Hits         1082     1209     +127     
+ Misses        183      150      -33     
+ Partials       41       37       -4     
Impacted Files Coverage Δ
src/pytest_mock_resources/container/base.py 80.68% <66.66%> (+22.54%) :arrow_up:
src/pytest_mock_resources/sqlalchemy.py 92.89% <93.75%> (ø)
src/pytest_mock_resources/fixture/moto.py 95.23% <95.23%> (ø)
src/pytest_mock_resources/__init__.py 100.00% <100.00%> (ø)
src/pytest_mock_resources/container/moto.py 100.00% <100.00%> (ø)
src/pytest_mock_resources/credentials.py 100.00% <100.00%> (ø)
src/pytest_mock_resources/fixture/__init__.py 100.00% <100.00%> (ø)
src/pytest_mock_resources/fixture/base.py 100.00% <100.00%> (ø)
src/pytest_mock_resources/fixture/mongo.py 100.00% <100.00%> (ø)
src/pytest_mock_resources/fixture/mysql.py 94.11% <100.00%> (ø)
... and 11 more

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