Skip to content

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

Closed

Description

@johnbaldwin

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

Activity

  1. 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[/+] on Mar 7, 2022
  2. johnbaldwin commented on Mar 7, 2022

    @johnbaldwin
    ContributorAuthor

    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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions