Skip to content
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

Merged
merged 12 commits into from
Feb 4, 2021

Conversation

AnnaDinaburgVulikh
Copy link
Contributor

Hi @shiramax ,
Edited the tests for lesson 3 (#369).
The changes include:

  1. Invoking the test through rose-check.py
  2. Enabled custom test directory.
  3. Split the tests into 2 files, one for variables homework and the second for strings homework.
  4. Added missing tests.
  5. Updated README.
    Please let me know if fixes are needed.

Acepresso and others added 7 commits December 28, 2020 21:45
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
Copy link
Collaborator

@shiramax shiramax left a 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.

docs/course_materials/exercises/test_exercises/README.md Outdated Show resolved Hide resolved
docs/course_materials/exercises/test_exercises/README.md Outdated Show resolved Hide resolved
docs/course_materials/exercises/test_exercises/README.md Outdated Show resolved Hide resolved
@AnnaDinaburgVulikh
Copy link
Contributor Author

To check the variables homework you should run:

python rose_check.py -t variables -s downloads

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.
@AnnaDinaburgVulikh
Copy link
Contributor Author

Hi @shiramax, dealt with the running of the checks, help, and README.
Still working on improving the test for python (feedback for each tested line/answer instead of overall test).

@AnnaDinaburgVulikh
Copy link
Contributor Author

Hi @shiramax, updated the tests to give full feedback, addressing every line tested.

Copy link
Collaborator

@shiramax shiramax left a 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!

@AnnaDinaburgVulikh
Copy link
Contributor Author

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?
Copy link
Collaborator

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

Copy link
Contributor Author

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?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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.

Copy link
Collaborator

@shiramax shiramax left a 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!

@shiramax shiramax merged commit 9eef3b9 into RedHat-Israel:master Feb 4, 2021
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.

3 participants