Skip to content

How to override docker environment variables? #29

Closed

Description

@stevenengland

Hi at all,

thanks for this awesome helper library. I managed to get everything working for a local installation. There a environment variable is set successfully when running pytest. Now I want to setup a docker based test environment. The docker image sets this environment variable upfront and I want pytest-env to override it.

Here is the setup.cfg that is working within the non docker installation:

[tool:pytest]
# Set environment vars for test runs only (needs pytest-env package)
env =
    DJANGO_ENV=test

The same setup.cfg has no effect when running pytest in docker.

Since the environment variable is set via ENV command in a Dockerfile, it has the least precedence and should be easily overridable.

Would you say that this scenario is valid and I need to investigate further, where the issue comes from? Any ideas what I might check?

Activity

  1. gaborbernat commented on Apr 11, 2023

    @gaborbernat
    Collaborator

    This should work. You must be missing something somewhere, but I'm unable to help with the limited information you provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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