[
  {
    "path": ".gitignore",
    "content": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nenv/\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\n*.egg-info/\n.installed.cfg\n*.egg\n\n# PyInstaller\n#  Usually these files are written by a python script from a template\n#  before PyInstaller builds the exe, so as to inject date/other infos into it.\n*.manifest\n*.spec\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.coverage\n.cache\nnosetests.xml\ncoverage.xml\n\n# Translations\n*.mo\n*.pot\n\n# Django stuff:\n*.log\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\ntarget/"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2020 Marcel Radischat\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "MANIFEST.in",
    "content": "include LICENSE\ninclude README.md\n\nrecursive-exclude * __pycache__\nrecursive-exclude * *.py[co]\n"
  },
  {
    "path": "README.md",
    "content": "# Discontinued\n\nThis project is not maintained any longer - sorry for any inconvenience this might cause.\n\n# pytest-dotenv\n\nThis little plugin uses `python-dotenv` to load any environment variables from\na `.env` file. Extra configuration can be defined in any `pytest` config files,\nsuch as `pytest.ini`, `tox.ini` and so on.\n\n## Installation\n\nInstall the plugin with `pip`:\n\n```sh\npip install pytest-dotenv\n```\n\n## Basic Usage\n\nIf all you want is to load environment variables from a `.env` file then\ninstalling the plugin is all that is needed. `python-dotenv` will automatically\ndetect your `.env` file and load it. By default, the plugin won't override any\nexisting system variables.\n\n## Non-default configuration\n\n### Custom Environment Variable Files\n\nAdd a new section named `env_files` to your pytest config file.\nYou can list as many files as necessary:\n\n```ini\n[pytest]\nenv_files =\n    .env\n    .test.env\n    .deploy.env\n```\n\nThe files will be loaded and added to the `os.environ` dict object before any\ntests are run. If the files are not found on the working directory, it will\nsearch for the files in the ancestor directory and upwards.\n\n### Overriding Existing Values\n\nBy default the plugin will not override any variables already defined in the\nprocess' environment. If you want that behavior, you have to use the\n`env_override_existing_values` setting:\n\n```ini\n[pytest]\nenv_override_existing_values = 1\nenv_files =\n    .env\n    .test.env\n    .deploy.env\n```\n\n### Alternative: Specify the file at the command line\n\nYou also have the option to run your tests with `py.test --envfile\npath/to/.env`.  This will load all defined environment variables and overwrite\nany existing ones regardless of the configuration\n`env_override_existing_values`.\n"
  },
  {
    "path": "pytest_dotenv/__init__.py",
    "content": "__version__='0.5.2'\n__author__='Marcel Radischat'\n"
  },
  {
    "path": "pytest_dotenv/plugin.py",
    "content": "# -*- coding: utf-8 -*-\n\nfrom dotenv import load_dotenv, find_dotenv\n\nimport pytest\n\n\ndef pytest_addoption(parser):\n    parser.addini(\"env_files\",\n                  type=\"linelist\",\n                  help=\"a line separated list of env files to parse\",\n                  default=['.env'])\n    parser.addini(\"env_override_existing_values\",\n                  type=\"bool\",\n                  help=\"override the existing environment variables\",\n                  default=False)\n    parser.addoption(\"--envfile\",\n                    dest=\"envfile\",\n                    default=\"foo\",\n                    type=str,\n                    help=\"Overwrite any environment variable specified in this file. This argument ignores the .ini settings.\")\n\n\n@pytest.hookimpl(tryfirst=True)\ndef pytest_load_initial_conftests(args, early_config, parser):\n    _override = early_config.getini(\"env_override_existing_values\")\n    for filename in early_config.getini(\"env_files\"):\n        load_dotenv(find_dotenv(filename, usecwd=True), override=_override)\n\n\ndef pytest_sessionstart(session):\n    config = session.config\n    if config.getoption(\"envfile\", default=None) is not None:\n        load_dotenv(dotenv_path=config.getoption(\"envfile\"), override=True)\n"
  },
  {
    "path": "setup.cfg",
    "content": "[metadata]\ndescription-file = README.md"
  },
  {
    "path": "setup.py",
    "content": "from setuptools import setup\nfrom os import path\n\ndescription = 'A py.test plugin that parses environment files before running tests'\n\n# read the contents of the README file\nthis_directory = path.abspath(path.dirname(__file__))\nwith open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:\n    long_description = f.read()\n\nsetup(\n    name='pytest-dotenv',\n    description=description,\n    long_description=long_description,\n    long_description_content_type='text/markdown',\n    version='0.5.2',\n    author='Marcel Radischat',\n    author_email='marcel@quiqua.eu',\n    url='https://github.com/quiqua/pytest-dotenv',\n    download_url='https://github.com/quiqua/pytest-dotenv/tarball/0.5.2',\n    packages=['pytest_dotenv'],\n    entry_points={'pytest11': ['dotenv = pytest_dotenv.plugin']},\n    install_requires=['pytest>=5.0.0', 'python-dotenv>=0.9.1'],\n    classifiers=[\n        'Development Status :: 4 - Beta',\n        'Intended Audience :: Developers',\n        'License :: OSI Approved :: MIT License',\n        'Natural Language :: English',\n        'Programming Language :: Python :: 2',\n        'Programming Language :: Python :: 2.6',\n        'Programming Language :: Python :: 2.7',\n        'Programming Language :: Python :: 3',\n        'Programming Language :: Python :: 3.3',\n        'Programming Language :: Python :: 3.4',\n        'Programming Language :: Python :: 3.5',\n        'Programming Language :: Python :: 3.6',\n        'Programming Language :: Python :: 3.7',\n        'Programming Language :: Python :: 3.8',\n    ]\n)"
  },
  {
    "path": "tests/conftest.py",
    "content": "pytest_plugins = 'pytester'\n"
  },
  {
    "path": "tests/test_dotenv.py",
    "content": "# -*- coding: utf-8 -*-\nfrom unittest import mock\n\nimport pytest\n\n\n@pytest.fixture\ndef mock_os_environ():\n    with mock.patch.dict(\"os.environ\", clear=True) as m:\n        yield m\n\n\n@pytest.mark.usefixtures(\"mock_os_environ\")\ndef test_ini_file(testdir):\n    testdir.makeini(\"\"\"\n        [pytest]\n        env_files =\n            myenv.txt\n    \"\"\")\n\n    testdir.maketxtfile(myenv=\"FOO=BAR\\nSPAM=EGGS\")\n\n    # create a temporary pytest test module\n    testdir.makepyfile(\"\"\"\n        import os\n\n        def test_env_foo():\n            assert os.environ.get('FOO') == 'BAR'\n\n        def test_env_spam():\n            assert os.environ.get('SPAM') == 'EGGS'\n    \"\"\")\n\n    # run pytest with the following cmd args\n    result = testdir.runpytest(\"-v\")\n\n    # fnmatch_lines does an assertion internally\n    result.stdout.fnmatch_lines([\n        '*::test_env_foo PASSED*',\n        '*::test_env_spam PASSED*'\n    ])\n\n    # make sure that that we get a '0' exit code for the testsuite\n    assert result.ret == 0\n\n\n@pytest.mark.usefixtures(\"mock_os_environ\")\ndef test_ini_file_refuse_overwrite(testdir):\n    testdir.makeini(\"\"\"\n        [pytest]\n        env_override_existing_values = 0\n        env_files =\n            myenv.txt\n            overwrite.txt\n    \"\"\")\n\n    testdir.maketxtfile(myenv=\"FOO=BAR\\nSPAM=EGGS\")\n    testdir.maketxtfile(overwrite=\"FOO=EGGS\\nSPAM=BAR\")\n    # create a temporary pytest test module\n    testdir.makepyfile(\"\"\"\n        import os\n\n        def test_env_foo():\n            assert os.environ.get('FOO') == 'BAR'\n\n        def test_env_spam():\n            assert os.environ.get('SPAM') == 'EGGS'\n    \"\"\")\n\n    # run pytest with the following cmd args\n    result = testdir.runpytest(\"-v\")\n\n    # fnmatch_lines does an assertion internally\n    result.stdout.fnmatch_lines([\n        '*::test_env_foo PASSED*',\n        '*::test_env_spam PASSED*'\n    ])\n\n    # make sure that that we get a '0' exit code for the testsuite\n    assert result.ret == 0\n\n\n@pytest.mark.usefixtures(\"mock_os_environ\")\ndef test_ini_file_allow_overwrite(testdir):\n    testdir.makeini(\"\"\"\n        [pytest]\n        env_override_existing_values = 1\n        env_files =\n            myenv.txt\n            overwrite.txt\n    \"\"\")\n\n    testdir.maketxtfile(myenv=\"FOO=BAR\\nSPAM=EGGS\")\n    testdir.maketxtfile(overwrite=\"FOO=EGGS\\nSPAM=BAR\")\n    # create a temporary pytest test module\n    testdir.makepyfile(\"\"\"\n        import os\n\n        def test_env_foo():\n            assert os.environ.get('FOO') == 'EGGS'\n\n        def test_env_spam():\n            assert os.environ.get('SPAM') == 'BAR'\n    \"\"\")\n\n    # run pytest with the following cmd args\n    result = testdir.runpytest(\"-v\")\n\n    # fnmatch_lines does an assertion internally\n    result.stdout.fnmatch_lines([\n        '*::test_env_foo PASSED*',\n        '*::test_env_spam PASSED*'\n    ])\n\n    # make sure that that we get a '0' exit code for the testsuite\n    assert result.ret == 0\n\n\n@pytest.mark.usefixtures(\"mock_os_environ\")\ndef test_file_argument_force_overwrite(testdir):\n    testdir.makeini(\"\"\"\n        [pytest]\n        env_files =\n            myenv.txt\n    \"\"\")\n\n    testdir.maketxtfile(myenv=\"FOO=BAR\\nSPAM=EGGS\")\n    tmp_env_file = testdir.maketxtfile(tmpenv=\"FOO=BAZ\\nBAR=SPAM\")\n    # create a temporary pytest test module\n    testdir.makepyfile(\"\"\"\n        import os\n\n        def test_env_foo():\n            assert os.environ.get('FOO') == 'BAZ'\n\n        def test_env_spam():\n            assert os.environ.get('SPAM') == 'EGGS'\n\n        def test_env_bar():\n            assert os.environ.get('BAR') == 'SPAM'\n    \"\"\")\n\n    # run pytest with the following cmd args\n    result = testdir.runpytest(\"-v\", \"--envfile\", str(tmp_env_file))\n\n    # fnmatch_lines does an assertion internally\n    result.stdout.fnmatch_lines([\n        '*::test_env_foo PASSED*',\n        '*::test_env_spam PASSED*',\n        '*::test_env_bar PASSED*'\n    ])\n\n    # make sure that that we get a '0' exit code for the testsuite\n    assert result.ret == 0\n\n\n@pytest.mark.usefixtures(\"mock_os_environ\")\ndef test_env_is_set_before_test_session_is_started(testdir):\n    testdir.makeini(\"\"\"\n        [pytest]\n        env_files =\n            myenv.txt\n    \"\"\")\n\n    testdir.maketxtfile(myenv=\"FOO=BAR\")\n    testdir.makeconftest(\"\"\"\n        import os\n        \n        assert os.environ.get('FOO') == 'BAR'\n    \"\"\")\n    # create a temporary pytest test module\n    testdir.makepyfile(\"\"\"\n        import os\n\n        def test_env_foo():\n            assert os.environ.get('FOO') == 'BAR'\n    \"\"\")\n\n    # run pytest with the following cmd args\n    result = testdir.runpytest(\"-v\")\n\n    # fnmatch_lines does an assertion internally\n    result.stdout.fnmatch_lines([\n        '*::test_env_foo PASSED*',\n    ])\n\n    # make sure that that we get a '0' exit code for the testsuite\n    assert result.ret == 0\n"
  }
]