mitodl / rapid-response-xblock

a django app plug-in for edx-platform
BSD 3-Clause "New" or "Revised" License
0 stars 2 forks source link

Fix the broken tests, lint error/warnings as per the latest open edx release #124

Closed arslanashraf7 closed 2 years ago

arslanashraf7 commented 2 years ago

Description:

While fixing a small bug recently(https://github.com/mitodl/rapid-response-xblock/pull/123) we noticed that the tests on CI are broken. It was also noticed that new linting errors have been introduced.

This is sometimes expected as we move along with the latest changes in the edX. And our CI checks run the integration tests/lint within the edX environment which is being updated continuously.

How to reproduce:

Just take a look at the failing CI here and you should be able to notice things like (Below warnings):

====================== 45 failed, 185 warnings in 56.89s =======================
************* Module rapid_response_xblock.logger
/rapid-response-xblock/rapid_response_xblock/logger.py:12:0: C0411: third party import "from rapid_response_xblock.models import RapidResponseRun, RapidResponseSubmission" should be placed before "from common.djangoapps.track.backends import BaseBackend" (wrong-import-order)
/rapid-response-xblock/rapid_response_xblock/logger.py:16:0: C0411: third party import "from rapid_response_xblock.block import MULTIPLE_CHOICE_TYPE" should be placed before "from common.djangoapps.track.backends import BaseBackend" (wrong-import-order)

and (test failures)

self = <xmodule.modulestore.split_mongo.split_draft.DraftVersioningModuleStore object at 0x7fe67dd87820>
.
.
            if index is None:
>               raise ItemNotFoundError(course_key)
E               xmodule.modulestore.exceptions.ItemNotFoundError: course-v1:SGAU+SGA101+2017_SGA+branch@draft-branch

Possible Resolution:

Background

We recently shifted our tests to run on the master branch which we used to run on one of the named release branches of our forks in mitodl. The PR is https://github.com/mitodl/rapid-response-xblock/pull/111/files#r728890729 with the reason mentioned about why we did that.

arslanashraf7 commented 2 years ago

Update:

While looking at the ticket I saw a couple of issues that I'd mention for the sake of posterity.

1) All Unit tests broken 2) Codejail remote URL error 3) Warnings

For Unit Tests:

We were using modulestore based test cases for our tests for setting up initial data for our tests to run upon. In some recent changes, the default test module store was set to split modulestore and an amnesty setting (TEST_DATA_MONGO_AMNESTY_MODULESTORE) was introduced which could be used for older tests for the sake of simplicity.

So the solution in our fix PR is also inspired by this fix PR. It's possible that a new way of defining the tests with split modulestore might be introduced soon and then we can update our test structure.

For Codejail:

Running out CI with the latest edX, we started seeing RemoteNotFound errors on codejail package. It turned out that the package was moved from /edx to /edxorg on github and a redirect is available for that which works in edX.

Looking around we applied Sudo based fix in our CI as done in edX and it worked for us too.

For Warnings:

We'll ignore most of them since they come from within edX but fix some that are related to our package.

arslanashraf7 commented 2 years ago

Closed via #126