-
Notifications
You must be signed in to change notification settings - Fork 108
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
chore: enabling integration tests #355
Conversation
4310b9d
to
7d7da18
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #355 +/- ##
==========================================
+ Coverage 53.75% 61.40% +7.65%
==========================================
Files 16 16
Lines 1680 1705 +25
Branches 115 115
==========================================
+ Hits 903 1047 +144
+ Misses 764 642 -122
- Partials 13 16 +3 ☔ View full report in Codecov by Sentry. |
faeb281
to
35f4609
Compare
35f4609
to
f34b8ca
Compare
@Anas12091101 We need to add |
@arslanashraf7 thanks for your comment. I think we don't need to add |
wow, That increased the coverage to the passing limit. But whenever we need to make changes in how codecov is configured we will need to add it. But thanks for letting me know. I'll take a look at the PR. |
@Anas12091101 Could you rebase this PR? |
5690a6d
to
5e8c757
Compare
5e8c757
to
7a6fbc8
Compare
- name: Run Integration Tests | ||
run: | | ||
cd .. | ||
git clone https://github.com/openedx/devstack |
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 was getting an error in the CI on make dev.clone.https command
: make: *** No rule to make target 'dev.clone.https'. Stop.
I also reproduced the error locally. The command works fine in the openedx/devstack
repository.
I replaced https://github.com/edx/devstack
with https://github.com/openedx/devstack
.
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 tried to test this in the rapid response repo which is also using https://github.com/edx/devstack
repository. The test PR throws the same error in the CI run.
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.
Thanks for making this change.
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.
Just one last question, the rest is looking great.
self.personalize(block, **student) | ||
user = student["module"].student | ||
student_id = anonymous_id_for_user(user,self.course_id) | ||
with mock.patch.object(StaffGradedAssignmentXBlock.get_submission,"__defaults__",(student_id,)): |
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.
Can you tell me more about why we needed this mocking? What made the existing tests break, were they not getting the StaffGradedAssignmentXBlock
object now or was there some other reason?
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 was getting no submission object when the test was running. When I dig into it, I found that our SGA xblock is created with the staff user name
in the make_one
fn and our submission is being made with the student_id
. The test is using block.student_view()
which is calling self.student_state()
-> self.get_submission()
-> self.get_student_item_dict(student_id is None)
. By default the student_id is None and hence the xblock sets the student_id to the staff_id here. Therefore I mocked the get_submission
method to use the student_id of the student, by which we have created the submission and not the staff id.
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.
Alright, So, wouldn't it make sense to create both the SGA block and the submission with Student ID when we are testing it with a student? We might probably achieve this by adding an extra param in make_one
method it uses the staff username as default when the username isn't passed to the function, otherwise use the username passed?
- name: Run Integration Tests | ||
run: | | ||
cd .. | ||
git clone https://github.com/openedx/devstack |
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.
Thanks for making this change.
d3406c0
to
7a6fbc8
Compare
21dd27f
to
7a6fbc8
Compare
@Anas12091101 I've re-run tests on this PR to check if a new xBlock package is available and if that fixes the issue now. |
5b95ad5
to
7e48031
Compare
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.
👍 Thanks for the patience on this. Don't forget to squash & merge.
What are the relevant tickets?
#354
What does this PR do?
This PR fixes integration tests and adds them to the GitHub CI workflow.
How should this be manually tested?
For local testing:
pytest.ini
file usingrm ./pytest.ini
.setup.cfg
file from edx-platform usingcp /edx/app/edxapp/edx-platform/setup.cfg .
.pytest ./edx_sga/tests/integration_tests.py
.