Hello community,
here is the log from the commit of package python-pytest-dotenv for
openSUSE:Factory checked in at 2020-06-29 21:17:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-dotenv (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-dotenv.new.3060 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-dotenv"
Mon Jun 29 21:17:58 2020 rev:3 rq:817667 version:0.5.2
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-pytest-dotenv/python-pytest-dotenv.changes
2020-06-10 00:49:50.299168212 +0200
+++
/work/SRC/openSUSE:Factory/.python-pytest-dotenv.new.3060/python-pytest-dotenv.changes
2020-06-29 21:18:27.545801404 +0200
@@ -1,0 +2,6 @@
+Mon Jun 29 09:48:03 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- Update to 0.5.2
+ * Set env variables before starting pytest session
+
+-------------------------------------------------------------------
Old:
----
0.5.1.tar.gz
New:
----
0.5.2.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-dotenv.spec ++++++
--- /var/tmp/diff_new_pack.f8WOUn/_old 2020-06-29 21:18:28.053802976 +0200
+++ /var/tmp/diff_new_pack.f8WOUn/_new 2020-06-29 21:18:28.053802976 +0200
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-pytest-dotenv
-Version: 0.5.1
+Version: 0.5.2
Release: 0
Summary: A pytest plugin that parses environment files
License: MIT
++++++ 0.5.1.tar.gz -> 0.5.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-dotenv-0.5.1/pytest_dotenv/__init__.py
new/pytest-dotenv-0.5.2/pytest_dotenv/__init__.py
--- old/pytest-dotenv-0.5.1/pytest_dotenv/__init__.py 2020-06-05
13:25:02.000000000 +0200
+++ new/pytest-dotenv-0.5.2/pytest_dotenv/__init__.py 2020-06-16
14:33:04.000000000 +0200
@@ -1,2 +1,2 @@
-__version__='0.5.1'
+__version__='0.5.2'
__author__='Marcel Radischat'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-dotenv-0.5.1/pytest_dotenv/plugin.py
new/pytest-dotenv-0.5.2/pytest_dotenv/plugin.py
--- old/pytest-dotenv-0.5.1/pytest_dotenv/plugin.py 2020-06-05
13:25:02.000000000 +0200
+++ new/pytest-dotenv-0.5.2/pytest_dotenv/plugin.py 2020-06-16
14:33:04.000000000 +0200
@@ -21,11 +21,14 @@
help="Overwrite any environment variable specified in this
file. This argument ignores the .ini settings.")
-def pytest_sessionstart(session):
- config = session.config
- _override = config.getini("env_override_existing_values")
- for filename in config.getini("env_files"):
[email protected](tryfirst=True)
+def pytest_load_initial_conftests(args, early_config, parser):
+ _override = early_config.getini("env_override_existing_values")
+ for filename in early_config.getini("env_files"):
load_dotenv(find_dotenv(filename, usecwd=True), override=_override)
+
+def pytest_sessionstart(session):
+ config = session.config
if config.getoption("envfile", default=None) is not None:
- load_dotenv(dotenv_path=config.getoption("envfile"), override=True)
+ load_dotenv(dotenv_path=config.getoption("envfile"), override=True)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-dotenv-0.5.1/setup.py
new/pytest-dotenv-0.5.2/setup.py
--- old/pytest-dotenv-0.5.1/setup.py 2020-06-05 13:25:02.000000000 +0200
+++ new/pytest-dotenv-0.5.2/setup.py 2020-06-16 14:33:04.000000000 +0200
@@ -13,11 +13,11 @@
description=description,
long_description=long_description,
long_description_content_type='text/markdown',
- version='0.5.1',
+ version='0.5.2',
author='Marcel Radischat',
author_email='[email protected]',
url='https://github.com/quiqua/pytest-dotenv',
- download_url='https://github.com/quiqua/pytest-dotenv/tarball/0.5.1',
+ download_url='https://github.com/quiqua/pytest-dotenv/tarball/0.5.2',
packages=['pytest_dotenv'],
entry_points={'pytest11': ['dotenv = pytest_dotenv.plugin']},
install_requires=['pytest>=5.0.0', 'python-dotenv>=0.9.1'],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-dotenv-0.5.1/tests/test_dotenv.py
new/pytest-dotenv-0.5.2/tests/test_dotenv.py
--- old/pytest-dotenv-0.5.1/tests/test_dotenv.py 2020-06-05
13:25:02.000000000 +0200
+++ new/pytest-dotenv-0.5.2/tests/test_dotenv.py 2020-06-16
14:33:04.000000000 +0200
@@ -1,145 +1,188 @@
# -*- coding: utf-8 -*-
from unittest import mock
+import pytest
+
+
[email protected]
+def mock_os_environ():
+ with mock.patch.dict("os.environ", clear=True) as m:
+ yield m
+
+
[email protected]("mock_os_environ")
def test_ini_file(testdir):
- with mock.patch.dict('os.environ', clear=True):
- testdir.makeini("""
- [pytest]
- env_files =
- myenv.txt
- """)
-
- testdir.maketxtfile(myenv="FOO=BAR\nSPAM=EGGS")
-
- # create a temporary pytest test module
- testdir.makepyfile("""
- import os
-
- def test_env_foo():
- assert os.environ.get('FOO') == 'BAR'
-
- def test_env_spam():
- assert os.environ.get('SPAM') == 'EGGS'
- """)
-
- # run pytest with the following cmd args
- result = testdir.runpytest("-v")
-
- # fnmatch_lines does an assertion internally
- result.stdout.fnmatch_lines([
- '*::test_env_foo PASSED*',
- '*::test_env_spam PASSED*'
- ])
+ testdir.makeini("""
+ [pytest]
+ env_files =
+ myenv.txt
+ """)
+
+ testdir.maketxtfile(myenv="FOO=BAR\nSPAM=EGGS")
+
+ # create a temporary pytest test module
+ testdir.makepyfile("""
+ import os
+
+ def test_env_foo():
+ assert os.environ.get('FOO') == 'BAR'
+
+ def test_env_spam():
+ assert os.environ.get('SPAM') == 'EGGS'
+ """)
+
+ # run pytest with the following cmd args
+ result = testdir.runpytest("-v")
+
+ # fnmatch_lines does an assertion internally
+ result.stdout.fnmatch_lines([
+ '*::test_env_foo PASSED*',
+ '*::test_env_spam PASSED*'
+ ])
- # make sure that that we get a '0' exit code for the testsuite
- assert result.ret == 0
+ # make sure that that we get a '0' exit code for the testsuite
+ assert result.ret == 0
[email protected]("mock_os_environ")
def test_ini_file_refuse_overwrite(testdir):
- with mock.patch.dict('os.environ', clear=True):
- testdir.makeini("""
- [pytest]
- env_override_existing_values = 0
- env_files =
- myenv.txt
- overwrite.txt
- """)
-
- testdir.maketxtfile(myenv="FOO=BAR\nSPAM=EGGS")
- testdir.maketxtfile(overwrite="FOO=EGGS\nSPAM=BAR")
- # create a temporary pytest test module
- testdir.makepyfile("""
- import os
-
- def test_env_foo():
- assert os.environ.get('FOO') == 'BAR'
-
- def test_env_spam():
- assert os.environ.get('SPAM') == 'EGGS'
- """)
-
- # run pytest with the following cmd args
- result = testdir.runpytest("-v")
-
- # fnmatch_lines does an assertion internally
- result.stdout.fnmatch_lines([
- '*::test_env_foo PASSED*',
- '*::test_env_spam PASSED*'
- ])
+ testdir.makeini("""
+ [pytest]
+ env_override_existing_values = 0
+ env_files =
+ myenv.txt
+ overwrite.txt
+ """)
+
+ testdir.maketxtfile(myenv="FOO=BAR\nSPAM=EGGS")
+ testdir.maketxtfile(overwrite="FOO=EGGS\nSPAM=BAR")
+ # create a temporary pytest test module
+ testdir.makepyfile("""
+ import os
+
+ def test_env_foo():
+ assert os.environ.get('FOO') == 'BAR'
+
+ def test_env_spam():
+ assert os.environ.get('SPAM') == 'EGGS'
+ """)
+
+ # run pytest with the following cmd args
+ result = testdir.runpytest("-v")
+
+ # fnmatch_lines does an assertion internally
+ result.stdout.fnmatch_lines([
+ '*::test_env_foo PASSED*',
+ '*::test_env_spam PASSED*'
+ ])
- # make sure that that we get a '0' exit code for the testsuite
- assert result.ret == 0
+ # make sure that that we get a '0' exit code for the testsuite
+ assert result.ret == 0
[email protected]("mock_os_environ")
def test_ini_file_allow_overwrite(testdir):
- with mock.patch.dict('os.environ', clear=True):
- testdir.makeini("""
- [pytest]
- env_override_existing_values = 1
- env_files =
- myenv.txt
- overwrite.txt
- """)
-
- testdir.maketxtfile(myenv="FOO=BAR\nSPAM=EGGS")
- testdir.maketxtfile(overwrite="FOO=EGGS\nSPAM=BAR")
- # create a temporary pytest test module
- testdir.makepyfile("""
- import os
-
- def test_env_foo():
- assert os.environ.get('FOO') == 'EGGS'
-
- def test_env_spam():
- assert os.environ.get('SPAM') == 'BAR'
- """)
-
- # run pytest with the following cmd args
- result = testdir.runpytest("-v")
-
- # fnmatch_lines does an assertion internally
- result.stdout.fnmatch_lines([
- '*::test_env_foo PASSED*',
- '*::test_env_spam PASSED*'
- ])
+ testdir.makeini("""
+ [pytest]
+ env_override_existing_values = 1
+ env_files =
+ myenv.txt
+ overwrite.txt
+ """)
+
+ testdir.maketxtfile(myenv="FOO=BAR\nSPAM=EGGS")
+ testdir.maketxtfile(overwrite="FOO=EGGS\nSPAM=BAR")
+ # create a temporary pytest test module
+ testdir.makepyfile("""
+ import os
+
+ def test_env_foo():
+ assert os.environ.get('FOO') == 'EGGS'
+
+ def test_env_spam():
+ assert os.environ.get('SPAM') == 'BAR'
+ """)
+
+ # run pytest with the following cmd args
+ result = testdir.runpytest("-v")
+
+ # fnmatch_lines does an assertion internally
+ result.stdout.fnmatch_lines([
+ '*::test_env_foo PASSED*',
+ '*::test_env_spam PASSED*'
+ ])
- # make sure that that we get a '0' exit code for the testsuite
- assert result.ret == 0
+ # make sure that that we get a '0' exit code for the testsuite
+ assert result.ret == 0
[email protected]("mock_os_environ")
def test_file_argument_force_overwrite(testdir):
- with mock.patch.dict('os.environ', clear=True):
- testdir.makeini("""
- [pytest]
- env_files =
- myenv.txt
- """)
-
- testdir.maketxtfile(myenv="FOO=BAR\nSPAM=EGGS")
- tmp_env_file = testdir.maketxtfile(tmpenv="FOO=BAZ\nBAR=SPAM")
- # create a temporary pytest test module
- testdir.makepyfile("""
- import os
-
- def test_env_foo():
- assert os.environ.get('FOO') == 'BAZ'
-
- def test_env_spam():
- assert os.environ.get('SPAM') == 'EGGS'
-
- def test_env_bar():
- assert os.environ.get('BAR') == 'SPAM'
- """)
-
- # run pytest with the following cmd args
- result = testdir.runpytest("-v", "--envfile", str(tmp_env_file))
-
- # fnmatch_lines does an assertion internally
- result.stdout.fnmatch_lines([
- '*::test_env_foo PASSED*',
- '*::test_env_spam PASSED*',
- '*::test_env_bar PASSED*'
- ])
+ testdir.makeini("""
+ [pytest]
+ env_files =
+ myenv.txt
+ """)
+
+ testdir.maketxtfile(myenv="FOO=BAR\nSPAM=EGGS")
+ tmp_env_file = testdir.maketxtfile(tmpenv="FOO=BAZ\nBAR=SPAM")
+ # create a temporary pytest test module
+ testdir.makepyfile("""
+ import os
+
+ def test_env_foo():
+ assert os.environ.get('FOO') == 'BAZ'
+
+ def test_env_spam():
+ assert os.environ.get('SPAM') == 'EGGS'
+
+ def test_env_bar():
+ assert os.environ.get('BAR') == 'SPAM'
+ """)
+
+ # run pytest with the following cmd args
+ result = testdir.runpytest("-v", "--envfile", str(tmp_env_file))
+
+ # fnmatch_lines does an assertion internally
+ result.stdout.fnmatch_lines([
+ '*::test_env_foo PASSED*',
+ '*::test_env_spam PASSED*',
+ '*::test_env_bar PASSED*'
+ ])
+
+ # make sure that that we get a '0' exit code for the testsuite
+ assert result.ret == 0
+
+
[email protected]("mock_os_environ")
+def test_env_is_set_before_test_session_is_started(testdir):
+ testdir.makeini("""
+ [pytest]
+ env_files =
+ myenv.txt
+ """)
+
+ testdir.maketxtfile(myenv="FOO=BAR")
+ testdir.makeconftest("""
+ import os
+
+ assert os.environ.get('FOO') == 'BAR'
+ """)
+ # create a temporary pytest test module
+ testdir.makepyfile("""
+ import os
+
+ def test_env_foo():
+ assert os.environ.get('FOO') == 'BAR'
+ """)
+
+ # run pytest with the following cmd args
+ result = testdir.runpytest("-v")
+
+ # fnmatch_lines does an assertion internally
+ result.stdout.fnmatch_lines([
+ '*::test_env_foo PASSED*',
+ ])
- # make sure that that we get a '0' exit code for the testsuite
- assert result.ret == 0
+ # make sure that that we get a '0' exit code for the testsuite
+ assert result.ret == 0