M220 python...pytest -m connection.This code is not working

Please someone help me get through this issue…
I tried everything and now feel helpless.

I think there might be some error in my “MFLIX_DB_URI”…
Please if someone could share me his/her complete URI which is working (obviously with the password and usename hidden)…

You really have to use your own cluster. Otherwise any test you do will alter the data on someone else cluster. It is best for you to share your configuration file and we will be able to tell you what is wrong.

Sorry sir I don’t get it.
What do you mean by configuration files in here?

This is what I found in <install directory>/bin/mongod.cfg

I just wanted to make it clear that error occurs at this point in the code:

This is in your .ini file.

Yes sir
the contents of my .ini files is like:

[PROD]
SECRET_KEY = super_secret_key_you_should_change
MFLIX_DB_URI = mongodb+srv://m001-student : m001-mongodb-basics@mflix.vl00b.azure.mongodb.net/test
MFLIX_NS = sample_mflix

[TEST]
SECRET_KEY = super_secret_testing_key
MFLIX_DB_URI = mongodb+srv://m001-student : m001-mongodb-basics@mflix.vl00b.azure.mongodb.net/test
MFLIX_NS = sample_mflix

please help me if I’m wrong at some place in my .ini file sir…
I shared it all sir please help…
I was facing problem to install packages using requirements.txt file direclty so i installed it one by one manually…

I am not sure but I think the extra white space that you have on both side of : might be causing this error.

Okay sir I removed the space and ran it again with the following commands:-
pytest -m LAB_UNIT_TEST_NAME
pytest -m connection
And these are the results I got.
Did it go well?
what does 4 passed, 39 deselected, 8 warnings mean??


Sir this is what appeared in “python run.py”

Sir actually i just did “pip install flask” which unsurprisingly installs the latest version present…
the requirements.txt had instead “pip install Flask==0.12.4”.
So i did for all the modules…
Does this create any problem which I dont think so should😔

First, the following is not a real test. It is a place holder to indicate the general format of a test.

Next, the line collected X items / Y deselected / Z selected, indicates that X test cases were found in the test directory, that Y do not correspond to the argument specified by -m and that Z match the argument specified by -m. Usually X equals Y plus Z. And if you the number of passed tests equals the number of selected tests, it means that this test suite is successful.

That’s correct. You got the validation code for the first lab.

1 Like

So should I move on to the next chapter or is there a problem yet…

If the lab works you may certainly go to the next section.

2 Likes

Sir could you tell me the solution for Ticket: Projection…

The code below :-

return list(db.movies.find({“countries”:{$in:countries}}, {"_id":1, “title”:1}).limit(1))

shows an error :-

return list(db.movies.find({“countries”:{$in:countries}}, {"_id":1, “title”:1}).limit(1))

I can understand that $ is not a keyword in python then what to use instead…

This post is not related to the same issue. Please create a new thread.

Put everything inside double quotes except variables.

1 Like

Try surrounding $in with double quotes like this “$in”

Kanika

ERROR: pyzmq has an invalid wheel, multiple .dist-info directories found: pyzmq-18.1.0.dist-info, libsodium-1.0.17.dist-info

this error showed up when i was trying to get the python library dependencies

:thinking: Is it resolved now? Sometimes the dependencies clash when we are not running in the virtual env/anaconda environment.

Kanika