Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@m-aciek
Copy link
Contributor

@m-aciek m-aciek commented May 19, 2021

This argument is passed to underlying methods, so effectively is supported, only check removal is required.

Remove test checking that read_concern is not supported.
@codecov
Copy link

codecov bot commented May 19, 2021

Codecov Report

❗ No coverage uploaded for pull request base (develop@b79b599). Click here to learn what that means.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop     #708   +/-   ##
==========================================
  Coverage           ?   95.33%           
==========================================
  Files              ?       19           
  Lines              ?     3665           
  Branches           ?        0           
==========================================
  Hits               ?     3494           
  Misses             ?      171           
  Partials           ?        0           
Impacted Files Coverage Δ
mongomock/collection.py 92.50% <100.00%> (ø)
mongomock/database.py 98.60% <100.00%> (ø)

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 b79b599...510d09f. Read the comment docs.

@m-aciek
Copy link
Contributor Author

m-aciek commented May 19, 2021

Read concern is supported since 0.19.1 #628

@m-aciek
Copy link
Contributor Author

m-aciek commented May 21, 2021

@pcorpet would it be possible for you to find time to review and merge this change?

@pcorpet
Copy link
Member

pcorpet commented May 22, 2021

Hi @m-aciek and thanks for your contribution. If we're going to go that way, please make it possible to use a with_options (both in collection and database).

However two things to do before removing those checks:

  • what should change in the behavior with a different read concern? From a quick glimpse to the doc, it seems that with a in-memory implementation with only one replica, all the read concerns will have the same effect. Please confirm.
  • let's still make sure that setting a bad type as a read_concern param in any of those functions would return the same error that pymongo would raise.

@m-aciek
Copy link
Contributor Author

m-aciek commented May 22, 2021

Thanks for looking into this.

Read concern works already in with_options of collection.

I think read concern shouldn't make a difference when using one replica, which we are mocking.

I wonder if I should bring a duck typing like in collection.with_options() (with using _WITH_OPTIONS_KWARGS) or just checking the type (first trying to import it from PyMongo, then from mongomock) is enough?

@pcorpet
Copy link
Member

pcorpet commented May 23, 2021

You're right, I think we're fine like this.

Pease cover the new lines with some new tests, and I'll merge it.

@m-aciek m-aciek force-pushed the patch-1 branch 2 times, most recently from 30aaae6 to ae37318 Compare May 24, 2021 07:27
@m-aciek
Copy link
Contributor Author

m-aciek commented May 24, 2021

I've added missing test. I've added read concern type check support in Collection constructor (the constructor may be called in Database().get_collection() method). Also removed read concern type check from Collection().with_options() as it is now handled in the constructor.

@m-aciek
Copy link
Contributor Author

m-aciek commented May 24, 2021

Pylint failure is not connected with changes here. I've added a new issue to track that: #709.

Is there a way to retrigger Codecov check?

Maciej Olko and others added 3 commits May 27, 2021 22:21
Throw a TypeError for read concern of wrong type.
Throw a TypeError for read concern of wrong type. Move check from with_options() to underlying constructor.
@m-aciek
Copy link
Contributor Author

m-aciek commented May 27, 2021

Added test for database.read_concern attribute, added setting default ReadConcern() if no value provided.

@pcorpet pcorpet merged commit 735a028 into mongomock:develop May 30, 2021
@pcorpet
Copy link
Member

pcorpet commented May 30, 2021

Thanks for all the cleanups and tests.

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.

2 participants