Closed rex-wang122 closed 2 years ago
Note: These steps assume you are
cd
'ed into theURS
directory.
First you should create a virtual environment. I use venv
so the command to create a virtual environment named env
would be:
$ python -m venv env
Then activate the virtual environment:
$ source env/bin/activate
Your terminal should now display some kind of indication that you are in the virtual environment. I believe the most common indication is an (env)
next to the prompt, assuming you have not done any heavy customization for your terminal.
Your virtual environment should be activated for the following steps.
pytest
You will have to install URS
's dependencies and pytest
in the virtual environment:
$ pip install -r requirements.txt
$ pip install pytest
pytest
Now you can run the test suite on your local machine:
$ python -m pytest
Once you are done with the virtual environment, you can deactivate it like so:
$ deactivate
The environment indication in your terminal's prompt should not be displayed anymore.
Depending on how your machine's clock was configured, there may be 11 local failures when you run pytest
. If you encounter these errors, keep in mind these are unique to your machine and not an issue with URS
.
These are the tests that may trigger the local failures:
test_Global.py
test_convert_time()
test_Subreddit.py
TestFormatSubmissionsFormatSubmissionsMethod().test_format_submissions()
TestFormatCSVFormatCsvMethod().test_format_csv()
test_Objectify.py
TestObjectifyMakeCommentMethod().test_make_comment_not_including_all_deleted_author_not_edited()
TestObjectifyMakeCommentMethod().test_make_comment_not_including_all_valid_author_edited()
TestObjectifyMakeCommentMethod().test_make_comment_including_all()
TestObjectifyMakeMultireddit().test_make_multireddit_no_subreddits()
TestObjectifyMakeMultireddit().test_make_multireddit_subreddits_present()
TestObjectifyMakeSubmission().test_make_submission_not_including_all_deleted_author_not_edited()
TestObjectifyMakeSubmission().test_make_submission_not_including_all_valid_author_edited()
TestObjectifyMakeSubmission().test_make_submission_including_all()
I want to run the unittest added in the tests folder, what command should I use?