learningequality / learningequality/studio

Repetitive loadconstants

Open
#1,443 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

TAG: performance TAG: unit tests
Dominant language
Python
Stars
191
Forks
307
Avg merge
5d 6h
Merged PRs (30d)
10

Description

Summary

If we cd to contentcuration and run pytest -s (to show stdout) we see hundreds of

***** Loading Constants *****
Site: 3 constants saved (2 new)
License: 9 constants saved (9 new)
ContentKind: 7 constants saved (7 new)
FileFormat: 14 constants saved (14 new)
FormatPreset: 22 constants saved (22 new)
Language: 248 constants saved (248 new)
************ DONE. ************

Category

Select one: TEST PERF

How to reproduce

# yarn run services in one tab
# in another tab
pipenv shell
cd contentcuration
pytest -s

Potential fix

replace https://github.com/learningequality/studio/blob/develop/contentcuration/contentcuration/tests/base.py#L47-L50
and https://github.com/learningequality/studio/blob/develop/contentcuration/contentcuration/tests/base.py#L80-L82 etc

with somethin like setUpModule and tearDownModule:
https://docs.python.org/3/library/unittest.html#setupmodule-and-teardownmodule

Real-life consequences

Tests will run a little faster on devs' machines and in CI.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in contentcuration/contentcuration/tests/base.py, especially the setup and teardown sections linked in the issue, and reproduce the repeated output with pytest -s after starting the services. Compare module-level setup and teardown behavior, then run the test suite to confirm constants load without repetitive output and tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
performance, testing-qa
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.