-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check homework - testing lesson 3 #425
Check homework - testing lesson 3 #425
Conversation
Signed-off-by: Guy Hartuv <[email protected]>
Automatic check of student's homework. Utilized using pytest framework. Signed-off-by: Guy Hartuv <[email protected]>
1. Split to 2 files according to the homework assignments. 2. Changed rose_check.py functionality to allow using calling pytest using mark for testing further assignments. 3. Added conftest.py that keeps all the public functions and variables for the tests using @pytest.fixture 4. Added pytest.ini that includes the custom markers for the assignment tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AnnaDinaburgVulikh
thanks for your contribution and your well written documentation!
I have some inline comments,
Also, I didn't quite understand, how should I run the tests,
I tried:
python rose_check.py --test_exercise variables --exercise_file ~/Downloads/variables.py
and got :
03_Variables_and_datatypes/test_homework_variables.py::test_variables_1
----------------------------------------------------------------- live log call ------------------------------------------------------------------
[ WARNING] Student homework file not found: /home/mshira/variables_1.py
FAILED [ 33%]
03_Variables_and_datatypes/test_homework_variables.py::test_variables_2
----------------------------------------------------------------- live log call ------------------------------------------------------------------
[ WARNING] Student homework file not found: /home/mshira/variables_2.py
FAILED [ 66%]
03_Variables_and_datatypes/test_homework_variables.py::test_calculations
----------------------------------------------------------------- live log call ------------------------------------------------------------------
[ WARNING] Student homework file not found: /home/mshira/calculations.txt
FAILED
I'm not sure how should I run the tests and where the files should be exactly.
To check the variables homework you should run:
It will search in the folder for the corresponding homework files as specified in the assignment. In each exercise we specify the file name wanted. |
1. Added a special command for the available tests list. 2. Made the existing commands universal for Python and Linux exercises. 3. Split the README to: running and adding test files.
Hi @shiramax, dealt with the running of the checks, help, and README. |
Hi @shiramax, updated the tests to give full feedback, addressing every line tested. |
docs/course_materials/exercises/test_exercises/README_run_tests.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work Anna!
I've added a few inline comments,
also for some reason when I install the pipenv shell the pytests is not installed, and I need to install it manually, do you happen to know why?
thanks!
...rse_materials/exercises/test_exercises/03_Variables_and_datatypes/test_homework_variables.py
Outdated
Show resolved
Hide resolved
...rse_materials/exercises/test_exercises/03_Variables_and_datatypes/test_homework_variables.py
Outdated
Show resolved
Hide resolved
docs/course_materials/exercises/test_exercises/README_run_tests.md
Outdated
Show resolved
Hide resolved
docs/course_materials/exercises/test_exercises/README_add_tests.md
Outdated
Show resolved
Hide resolved
docs/course_materials/exercises/test_exercises/README_add_tests.md
Outdated
Show resolved
Hide resolved
docs/course_materials/exercises/test_exercises/README_add_tests.md
Outdated
Show resolved
Hide resolved
...ourse_materials/exercises/test_exercises/03_Variables_and_datatypes/test_homework_strings.py
Outdated
Show resolved
Hide resolved
docs/course_materials/exercises/test_exercises/README_add_tests.md
Outdated
Show resolved
Hide resolved
docs/course_materials/exercises/test_exercises/README_add_tests.md
Outdated
Show resolved
Hide resolved
Hi @shiramax, resolved all changes requested. |
def test_calculations(helpers): | ||
helpers.set_student_file('calculations.txt') | ||
helpers.expected_pycode = [ | ||
# What is the result of 10 ** 3? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you change something here? after the commit I'm getting failures :
[ WARNING]
For 10 ** 3 the expected result is 1000
for x=1; x+=2 the expected result is 3
For float(1) the expected result is 1.0
For Number = ((((13 * 8 - 4) * 2 + 50) * 4 ) % 127 )*5
the expected result is 555
FAILED
for all the students work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the regex, it worked for the plain answers as '555'. Can you give an example for the answers that fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @shiramax, sorry for earlier. Fixed the regex for the calculations exercise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work Anna! thanks for your contribution!
Hi @shiramax ,
Edited the tests for lesson 3 (#369).
The changes include:
Please let me know if fixes are needed.