Skip to content

keyerror in TOX #14

Description

@JeffWScott

I'm not sure why it's so hard to get system environmental variables into TOX. I mean, how else do you use secret API keys in a shared environment (ie, not cloning them to github).

So I came across pytest-env because it looked exactly like I want, but it doesn't seem to be as easy as your readme would have me believe.

This is my pytest.ini

[pytest]
env =
    API_KEY={API_KEY}

In my conftest.ini I use it like this.

key = os.environ['API_KEY']

running tox gives me this error

  File "/mnt/e/Lamden/clove/.tox/python/lib/python3.6/site-packages/pytest_env/plugin.py", line 32, in pytest_load_initial_conftests
    value = value.format(**os.environ)
KeyError: 'API_KEY'

What do you think I'm doing wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions