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

CI failing on main branch (Python tests) #2382

Closed
pt2302 opened this issue Sep 3, 2024 · 2 comments · Fixed by #2389
Closed

CI failing on main branch (Python tests) #2382

pt2302 opened this issue Sep 3, 2024 · 2 comments · Fixed by #2389
Labels

Comments

@pt2302
Copy link
Contributor

pt2302 commented Sep 3, 2024

Expected Behavior

Python tests should be passing.

Current Behavior

Python tests are failing with this error:

/home/runner/work/mitxonline/mitxonline/frontend/staff-dashboard/build System check identified some issues: WARNINGS: ?: (urls.W005) URL namespace 'v1' isn't unique. You may not be able to reverse all URLs in this namespace cms.CoursePage.topics: (fields.W340) null has no effect on ManyToManyField. Migrations for 'courses': courses/migrations/0055_alter_program_availability.py - Alter field availability on program

Just attempting to apply migrations does not resolve this issue.

@pdpinch
Copy link
Member

pdpinch commented Sep 4, 2024

I thought maybe #2367 would have fixed this?

@arslanashraf7
Copy link
Contributor

FYI, Anyone who works on this ticket. I was randomly looking at this ticket but it caught my interest. Here are some details I figured out as to why this might be happening.

Our missing migration detection script ./scripts/test/detect_missing_migrations.sh in CI is complaining about a missing migration e.g. Migrations for 'courses': courses/migrations/0055_alter_program_availability.py - Alter field availability on program.

[TEST SUITE] ./scripts/test/detect_missing_migrations.sh
Error: one or more migrations are missing
Migrations for 'courses': courses/migrations/0055_alter_program_availability.py - Alter field availability on program
[TEST SUITE] ./scripts/test/no_auto_migrations.sh

I also looked at the code and there were no new changes in the models after we added the availability field in #2322.

So why is this migration being generated even without any model changes?

I think the problem propagated like this:

  1. The model is using choices=AVAILABILITY_CHOICES, default=AVAILABILITY_ANYTIME, max_length=255
  2. AVAILABILITY_CHOICES is a constant AVAILABILITY_CHOICES = list(zip(AVAILABILITY_TYPES, AVAILABILITY_TYPES))
  3. Now, this is where the actual problem might be, We are zipping a Set instead of a list on https://github.com/mitodl/mitxonline/blob/main/courses/constants.py#L37 as a choices list. Since sets are unordered so they are sometimes returning anytime and dated with different orders.

Potential Solution:

We should use the list in https://github.com/mitodl/mitxonline/blob/main/courses/constants.py#L37 instead of a set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants