Skip to content

Commit 54efe7f

Browse files
committed
Initial commit
0 parents  commit 54efe7f

File tree

6 files changed

+142
-0
lines changed

6 files changed

+142
-0
lines changed

.gitignore

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
5+
# C extensions
6+
*.so
7+
8+
# Distribution / packaging
9+
.Python
10+
env/
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
lib/
17+
lib64/
18+
parts/
19+
sdist/
20+
var/
21+
*.egg-info/
22+
.installed.cfg
23+
*.egg
24+
25+
# PyInstaller
26+
# Usually these files are written by a python script from a template
27+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
28+
*.manifest
29+
*.spec
30+
31+
# Installer logs
32+
pip-log.txt
33+
pip-delete-this-directory.txt
34+
35+
# Unit test / coverage reports
36+
htmlcov/
37+
.tox/
38+
.coverage
39+
.cache
40+
nosetests.xml
41+
coverage.xml
42+
43+
# Translations
44+
*.mo
45+
*.pot
46+
47+
# Django stuff:
48+
*.log
49+
50+
# Sphinx documentation
51+
docs/_build/
52+
53+
# PyBuilder
54+
target/

LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
The MIT License (MIT)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
pytest-env
2+
=================
3+
4+
This is a py.test plugin that enables you to set environment variables in the pytest.ini file.
5+
6+
Installation
7+
------------
8+
9+
Install with pip::
10+
11+
pip install pytest-env
12+
13+
Uninstall with pip::
14+
15+
pip uninstall pytest-env
16+
17+
Usage
18+
-----
19+
20+
In your pytest.ini file add a key value pair with `env` as the key and the environment variables as a line
21+
separated list of `KEY=VALUE` entries. The defined variables will be added to the environment before any tests are run:
22+
23+
[pytest]
24+
env =
25+
HOME=~/tmp
26+
RUN_ENV=test

pytest_env/__init__.py

Whitespace-only changes.

pytest_env/plugin.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import os
2+
3+
4+
def pytest_addoption(parser):
5+
parser.addini("env",
6+
type="linelist",
7+
help="a line separated list of environment variables of the form NAME=VALUE)",
8+
default=[])
9+
10+
11+
def pytest_load_initial_conftests(args, early_config, parser):
12+
for e in early_config.getini("env"):
13+
part = e.partition("=")
14+
key = part[0].strip()
15+
value = part[2].strip()
16+
os.environ[key] = value

setup.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from setuptools import setup
2+
3+
description = 'py.test plugin that allows you to add environment variables.'
4+
5+
setup(
6+
name='pytest-env',
7+
description=description,
8+
long_description=description,
9+
version='0.5',
10+
11+
author_email='[email protected]',
12+
url='https://github.com/MobileDynasty/pytest-env',
13+
packages=['pytest_env'],
14+
entry_points={'pytest11': ['env = pytest_env.plugin']},
15+
install_requires=['pytest>=2.6.0'],
16+
classifiers=[
17+
'Development Status :: 4 - Beta',
18+
'Intended Audience :: Developers',
19+
'License :: OSI Approved :: MIT License',
20+
'Natural Language :: English',
21+
'Programming Language :: Python :: 2',
22+
'Programming Language :: Python :: 2.6',
23+
'Programming Language :: Python :: 2.7',
24+
'Programming Language :: Python :: 3',
25+
'Programming Language :: Python :: 3.3',
26+
]
27+
)

0 commit comments

Comments
 (0)