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

Pytest is missing devsite .env file and default Open edX release #331

Closed
johnbaldwin opened this issue Apr 27, 2021 · 1 comment
Closed
Assignees

Comments

@johnbaldwin
Copy link
Contributor

Issue #1 pytest failes because devsite/devsite/.env does not exist

Running pytest fails with the following:

$ pytest
/home/jbaldwin/.pyenv/versions/3.5.10/envs/figpy35/lib/python3.5/site-packages/environ/environ.py:630: UserWarning: /home/jbaldwin/work/appsembler/ws/figures/devsite/devsite/.env doesn't exist - if you're not configuring your environment separately, create one.
  "environment separately, create one." % env_file)

Tox does work. Tox calling pytest works because tox defines environment variables that the devsite settings file expects. These enviroment var

The package used is here: https://github.com/joke2k/django-environ

It is unfortunate that the package seems to not be actively maintained. However, we use it only for Figures devsite and not in production.

Issue #2: There is not a default Open edX release defined. This can be seen if one creates an empty devsite/devsite/.env file.

The .env file loads environment variables that are then read in the devsite settings.py and test_settings.py files

There are options to fix this (here are just some):

  1. Improve the error message if .env is missing
  2. Add a default .env file with a default Open edX release
  3. For the test_settings.py, use a test.env file
  4. Remove use of django-environ and implement an alternate strategy for setting environment variables
  5. Dynamically create a .env file with default settings if one does not already exist

TODO: dig into the options and choose

  1. Quick fix for now
  2. Then long term solution
@johnbaldwin johnbaldwin changed the title Pytest is missing devsite .ev file and default Open edX release Pytest is missing devsite .env file and default Open edX release Mar 7, 2022
@johnbaldwin
Copy link
Contributor Author

I believe I fixed this with #443 (it works on my computer ;))

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

No branches or pull requests

2 participants