Hello community,

here is the log from the commit of package python-pytest-testconfig for 
openSUSE:Factory checked in at 2019-07-24 20:35:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-testconfig (Old)
 and      /work/SRC/openSUSE:Factory/.python-pytest-testconfig.new.4126 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pytest-testconfig"

Wed Jul 24 20:35:17 2019 rev:2 rq:718079 version:0.1.2

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-pytest-testconfig/python-pytest-testconfig.changes
        2019-05-16 22:06:36.558475668 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-pytest-testconfig.new.4126/python-pytest-testconfig.changes
      2019-07-24 20:35:19.278575494 +0200
@@ -1,0 +2,6 @@
+Wed Jul 24 07:05:24 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.1.2:
+  * Fix tests execution
+
+-------------------------------------------------------------------

Old:
----
  pytest-testconfig-0.1.1.tar.gz

New:
----
  pytest-testconfig-0.1.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pytest-testconfig.spec ++++++
--- /var/tmp/diff_new_pack.f3sjqO/_old  2019-07-24 20:35:20.638575345 +0200
+++ /var/tmp/diff_new_pack.f3sjqO/_new  2019-07-24 20:35:20.678575340 +0200
@@ -12,26 +12,28 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
+#
 
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-pytest-testconfig
-Version:        0.1.1
+Version:        0.1.2
 Release:        0
-License:        Apache-2.0
 Summary:        Test configuration plugin for pytest
-Url:            https://github.com/wojole/pytest-testconfig
+License:        Apache-2.0
 Group:          Development/Languages/Python
+URL:            https://github.com/wojole/pytest-testconfig
 Source:         
https://files.pythonhosted.org/packages/source/p/pytest-testconfig/pytest-testconfig-%{version}.tar.gz
-BuildRequires:  python-rpm-macros
+BuildRequires:  %{python_module PyYAML}
 BuildRequires:  %{python_module pytest >= 3.5}
-BuildRequires:  %{python_module tox}
 BuildRequires:  %{python_module setuptools}
+BuildRequires:  %{python_module tox}
 BuildRequires:  fdupes
+BuildRequires:  python-rpm-macros
 Requires:       python-pytest >= 3.5
+Recommends:     python-PyYAML
 BuildArch:      noarch
-
 %python_subpackages
 
 %description
@@ -49,9 +51,7 @@
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check
-# The tests don't work currently, but we have a PR here to fix this:
-#  https://github.com/wojole/pytest-testconfig/pull/2
-#%%pytest
+%pytest
 
 %files %{python_files}
 %license LICENSE

++++++ pytest-testconfig-0.1.1.tar.gz -> pytest-testconfig-0.1.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest-testconfig-0.1.1/MANIFEST.in 
new/pytest-testconfig-0.1.2/MANIFEST.in
--- old/pytest-testconfig-0.1.1/MANIFEST.in     2018-08-22 23:00:06.000000000 
+0200
+++ new/pytest-testconfig-0.1.2/MANIFEST.in     2019-06-21 12:19:50.000000000 
+0200
@@ -1,5 +1,6 @@
 include LICENSE
 include README.rst
+recursive-include tests
 
 recursive-exclude * __pycache__
 recursive-exclude * *.py[co]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest-testconfig-0.1.1/PKG-INFO 
new/pytest-testconfig-0.1.2/PKG-INFO
--- old/pytest-testconfig-0.1.1/PKG-INFO        2018-11-26 23:57:38.000000000 
+0100
+++ new/pytest-testconfig-0.1.2/PKG-INFO        2019-06-21 13:00:07.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: pytest-testconfig
-Version: 0.1.1
+Version: 0.1.2
 Summary: Test configuration plugin for pytest.
 Home-page: https://github.com/wojole/pytest-testconfig
 Author: Wojciech Olejarz, Bartlomiej Skrobek
@@ -87,7 +87,7 @@
         access. Tests can obviously access configuration data by referencing 
the
         relevant dictionary keys::
         
-            from testconfig import config
+            from pytest_testconfig import config
             def test_foo():
                 target_server_ip = config['servers']['webapp_ip']
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest-testconfig-0.1.1/README.rst 
new/pytest-testconfig-0.1.2/README.rst
--- old/pytest-testconfig-0.1.1/README.rst      2018-11-26 22:57:19.000000000 
+0100
+++ new/pytest-testconfig-0.1.2/README.rst      2019-06-21 12:56:19.000000000 
+0200
@@ -77,7 +77,7 @@
 access. Tests can obviously access configuration data by referencing the
 relevant dictionary keys::
 
-    from testconfig import config
+    from pytest_testconfig import config
     def test_foo():
         target_server_ip = config['servers']['webapp_ip']
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pytest-testconfig-0.1.1/pytest_testconfig.egg-info/PKG-INFO 
new/pytest-testconfig-0.1.2/pytest_testconfig.egg-info/PKG-INFO
--- old/pytest-testconfig-0.1.1/pytest_testconfig.egg-info/PKG-INFO     
2018-11-26 23:57:38.000000000 +0100
+++ new/pytest-testconfig-0.1.2/pytest_testconfig.egg-info/PKG-INFO     
2019-06-21 13:00:07.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: pytest-testconfig
-Version: 0.1.1
+Version: 0.1.2
 Summary: Test configuration plugin for pytest.
 Home-page: https://github.com/wojole/pytest-testconfig
 Author: Wojciech Olejarz, Bartlomiej Skrobek
@@ -87,7 +87,7 @@
         access. Tests can obviously access configuration data by referencing 
the
         relevant dictionary keys::
         
-            from testconfig import config
+            from pytest_testconfig import config
             def test_foo():
                 target_server_ip = config['servers']['webapp_ip']
         
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pytest-testconfig-0.1.1/pytest_testconfig.egg-info/SOURCES.txt 
new/pytest-testconfig-0.1.2/pytest_testconfig.egg-info/SOURCES.txt
--- old/pytest-testconfig-0.1.1/pytest_testconfig.egg-info/SOURCES.txt  
2018-11-26 23:57:38.000000000 +0100
+++ new/pytest-testconfig-0.1.2/pytest_testconfig.egg-info/SOURCES.txt  
2019-06-21 13:00:07.000000000 +0200
@@ -8,4 +8,6 @@
 pytest_testconfig.egg-info/dependency_links.txt
 pytest_testconfig.egg-info/entry_points.txt
 pytest_testconfig.egg-info/requires.txt
-pytest_testconfig.egg-info/top_level.txt
\ No newline at end of file
+pytest_testconfig.egg-info/top_level.txt
+tests/conftest.py
+tests/test_testconfig.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/pytest-testconfig-0.1.1/pytest_testconfig.egg-info/requires.txt 
new/pytest-testconfig-0.1.2/pytest_testconfig.egg-info/requires.txt
--- old/pytest-testconfig-0.1.1/pytest_testconfig.egg-info/requires.txt 
2018-11-26 23:57:38.000000000 +0100
+++ new/pytest-testconfig-0.1.2/pytest_testconfig.egg-info/requires.txt 
2019-06-21 13:00:07.000000000 +0200
@@ -1 +1,2 @@
 pytest>=3.5.0
+pyyaml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest-testconfig-0.1.1/pytest_testconfig.py 
new/pytest-testconfig-0.1.2/pytest_testconfig.py
--- old/pytest-testconfig-0.1.1/pytest_testconfig.py    2018-11-26 
22:51:59.000000000 +0100
+++ new/pytest-testconfig-0.1.2/pytest_testconfig.py    2019-06-21 
12:56:19.000000000 +0200
@@ -36,6 +36,7 @@
 been activated.  Did you specify --tc or any other command line option?"
 
 config = {}
+py_config = {}
 
 
 def tolist(val):
@@ -75,7 +76,7 @@
     except (ImportError):
         raise Exception('unable to import YAML package. Can not continue.')
     global config
-    parsed_config = yaml.load(codecs.open(os.path.expanduser(yaml_file), 'r', 
encoding).read())
+    parsed_config = yaml.safe_load(codecs.open(os.path.expanduser(yaml_file), 
'r', encoding).read())
     merge_map(config, parsed_config)
 
 
@@ -169,6 +170,7 @@
 def pytest_configure(config):
     """ Call the super and then validate and call the relevant parser for
     the configuration file passed in """
+    global py_config
     if not config.getoption('testconfig') and not 
config.getoption('overrides'):
         return
 
@@ -188,10 +190,10 @@
     for override in overrides:
         keys, val = override.split(":", 1)
         if config.getoption('exact'):
-            config[keys] = val
+            py_config[keys] = val
         else:
             # Create all *parent* keys that may not exist in the config
-            section = config
+            section = py_config
             keys = keys.split('.')
             for key in keys[:-1]:
                 if key not in section:
@@ -203,6 +205,8 @@
             section[key] = val
 
 
+config = py_config
+
 # Use an environment hack to allow people to set a config file to auto-load
 # in case they want to put tests they write through pychecker or any other
 # syntax thing which does an execute on the file.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest-testconfig-0.1.1/setup.py 
new/pytest-testconfig-0.1.2/setup.py
--- old/pytest-testconfig-0.1.1/setup.py        2018-11-26 23:44:07.000000000 
+0100
+++ new/pytest-testconfig-0.1.2/setup.py        2019-06-21 12:56:19.000000000 
+0200
@@ -13,7 +13,7 @@
 
 setup(
     name='pytest-testconfig',
-    version='0.1.1',
+    version='0.1.2',
     author='Wojciech Olejarz, Bartlomiej Skrobek',
     author_email='[email protected]',
     maintainer='Wojciech Olejarz, Bartlomiej Skrobek',
@@ -24,7 +24,7 @@
     long_description=read('README.rst'),
     py_modules=['pytest_testconfig'],
     python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
-    install_requires=['pytest>=3.5.0'],
+    install_requires=['pytest>=3.5.0', 'pyyaml'],
     classifiers=[
         'Development Status :: 4 - Beta',
         'Framework :: Pytest',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest-testconfig-0.1.1/tests/conftest.py 
new/pytest-testconfig-0.1.2/tests/conftest.py
--- old/pytest-testconfig-0.1.1/tests/conftest.py       1970-01-01 
01:00:00.000000000 +0100
+++ new/pytest-testconfig-0.1.2/tests/conftest.py       2019-06-20 
15:22:47.000000000 +0200
@@ -0,0 +1 @@
+pytest_plugins = 'pytester'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pytest-testconfig-0.1.1/tests/test_testconfig.py 
new/pytest-testconfig-0.1.2/tests/test_testconfig.py
--- old/pytest-testconfig-0.1.1/tests/test_testconfig.py        1970-01-01 
01:00:00.000000000 +0100
+++ new/pytest-testconfig-0.1.2/tests/test_testconfig.py        2019-06-21 
12:56:19.000000000 +0200
@@ -0,0 +1,247 @@
+# -*- coding: utf-8 -*-
+import os
+
+
+def test_tc_file_from_ini(testdir):
+    """Test for parsing configuration from ini file."""
+
+    testdir_path = os.getcwd()
+
+    # create a temporary ini configuration file
+    testdir.makefile(".ini", example_cfg="""
+    # INI
+    [myapp_servers1]
+    main_server = 10.1.1.1
+    secondary_server = 10.1.1.5
+    """)
+
+    testdir.makepyfile(
+        """
+        from pytest_testconfig import config
+
+        def test_foo():
+
+            target_server_ip = config['myapp_servers1']['main_server']
+            assert target_server_ip == '10.1.1.1'
+    """
+    )
+
+    # run pytest with the following cmd args
+    result = testdir.runpytest(
+        '--tc-file={}/example_cfg.ini'.format(testdir_path),
+        '-v'
+    )
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines([
+        '*test_tc_file_from_ini.py::test_foo PASSED*',
+    ])
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+
+
+def test_tc_file_from_json(testdir):
+    """Test for parsing configuration from json file."""
+
+    testdir_path = os.getcwd()
+    # create a temporary json configuration file
+    testdir.makefile(".json", example_cfg="""{
+    "myapp2": {
+                 "servers": {
+                                "main_server": "10.1.1.1",
+                                "secondary_server": "10.1.1.1"
+                            }
+             }
+    }
+    """)
+
+    testdir.makepyfile(
+        """
+        from pytest_testconfig import config
+
+        def test_foo():
+
+            target_server_ip = config['myapp2']['servers']['main_server']
+            assert target_server_ip == '10.1.1.1'
+    """
+    )
+
+    # run pytest with the following cmd args
+    result = testdir.runpytest(
+        '--tc-file={}/example_cfg.json'.format(testdir_path),
+        '--tc-format=json',
+        '-v'
+    )
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines([
+        '*test_tc_file_from_json.py::test_foo PASSED*',
+    ])
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+
+
+def test_tc_file_from_yaml(testdir):
+    """Test for parsing configuration from yaml file."""
+
+    testdir_path = os.getcwd()
+    # create a temporary yaml configuration file
+    testdir.makefile(".yaml", example_cfg="""
+    # YAML
+    myapp3:
+        servers:
+            main_server: 10.1.1.1
+            secondary_server: 10.1.1.2
+    """)
+
+    testdir.makepyfile(
+        """
+        from pytest_testconfig import config
+
+        def test_foo():
+
+            target_server_ip = config['myapp3']['servers']['main_server']
+            assert target_server_ip == '10.1.1.1'
+    """
+    )
+
+    # run pytest with the following cmd args
+    result = testdir.runpytest(
+        '--tc-file={}/example_cfg.yaml'.format(testdir_path),
+        '--tc-format=yaml',
+        '-v'
+    )
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines([
+        '*test_tc_file_from_yaml.py::test_foo PASSED*',
+    ])
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+
+
+def test_tc_override(testdir):
+    """Test for overriding configuration."""
+
+    testdir.makepyfile(
+        """
+        from pytest_testconfig import config
+
+        def test_foo():
+            target_server_ip = config['myapp_servers4']['secondary_server']
+            assert target_server_ip == '10.1.1.1'
+    """
+    )
+
+    # run pytest with the following cmd args
+    result = testdir.runpytest(
+        '--tc=myapp_servers4.secondary_server:10.1.1.1',
+        '-v',
+        '-s'
+    )
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines([
+        '*test_tc_override.py::test_foo PASSED*',
+    ])
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+
+
+def test_tc_exact_override(testdir):
+    """Test for overriding configuration with exact option."""
+
+    testdir.makepyfile(
+        """
+        from pytest_testconfig import config
+
+        def test_foo():
+            target_server_ip = config['myapp_servers.secondary_server']
+            assert target_server_ip == '10.1.1.1'
+    """
+    )
+
+    # run pytest with the following cmd args
+    result = testdir.runpytest(
+        '--tc=myapp_servers.secondary_server:10.1.1.1',
+        '--tc-exact',
+        '-v'
+    )
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines([
+        '*test_tc_exact_override.py::test_foo PASSED*',
+    ])
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+
+
+def test_tc_file_from_python(testdir):
+    """Test for parsing configuration from python file."""
+
+    testdir_path = os.getcwd()
+    # create a temporary py configuration file
+    testdir.makefile(".py", example_cfg="""
+    global config
+    config = {
+        'myapp5': {
+            'servers': {
+                'main_server': '.'.join(('10', '1', '1', '1',)),
+            }
+        }
+    }
+    """)
+
+    testdir.makepyfile(
+        """
+        from pytest_testconfig import config
+
+        def test_foo():
+
+            target_server_ip = config['myapp5']['servers']['main_server']
+            assert target_server_ip == '10.1.1.1'
+    """
+    )
+
+    # run pytest with the following cmd args
+    result = testdir.runpytest(
+        '--tc-file={}/example_cfg.py'.format(testdir_path),
+        '--tc-format=python',
+        '-v'
+    )
+
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines([
+        '*test_tc_file_from_python.py::test_foo PASSED*',
+    ])
+
+    # make sure that that we get a '0' exit code for the testsuite
+    assert result.ret == 0
+
+
+def test_help_message(testdir):
+    result = testdir.runpytest(
+        '--help',
+    )
+    # fnmatch_lines does an assertion internally
+    result.stdout.fnmatch_lines([
+        'test-config:',
+        '  --tc-file=TESTCONFIG  Configuration file to parse and pass to 
tests',
+        '                        [PY_TEST_CONFIG_FILE]',
+        '  --tc-file-encoding=TESTCONFIGENCODING',
+        '                        Test config file encoding, default is utf-8',
+        '                        [PY_TEST_CONFIG_FILE_ENCODING]',
+        '  --tc-format=TESTCONFIGFORMAT',
+        '                        Test config file format, default is 
configparser ini',
+        '                        format [PY_TEST_CONFIG_FILE_FORMAT]',
+        '  --tc=OVERRIDES        Option:Value specific overrides.',
+        '  --tc-exact            Optional: Do not explode periods in override 
keys to',
+        '                        individual keys within the config dict, 
instead treat',
+        '                        them as config[my.toplevel.key] ala 
sqlalchemy.url in',
+        '                        pylons',
+    ])


Reply via email to