Hello community,

here is the log from the commit of package python-dephell-discover for 
openSUSE:Factory checked in at 2019-09-13 15:03:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-dephell-discover (Old)
 and      /work/SRC/openSUSE:Factory/.python-dephell-discover.new.7948 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-dephell-discover"

Fri Sep 13 15:03:50 2019 rev:3 rq:730650 version:0.2.8

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-dephell-discover/python-dephell-discover.changes
  2019-08-24 18:49:09.701741339 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-dephell-discover.new.7948/python-dephell-discover.changes
        2019-09-13 15:05:13.217257987 +0200
@@ -1,0 +2,6 @@
+Fri Sep 13 09:18:23 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.2.8:
+  * ship tests
+
+-------------------------------------------------------------------

Old:
----
  dephell_discover-0.2.1.tar.gz

New:
----
  dephell_discover-0.2.8.tar.gz

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

Other differences:
------------------
++++++ python-dephell-discover.spec ++++++
--- /var/tmp/diff_new_pack.nOY4UD/_old  2019-09-13 15:05:14.129257793 +0200
+++ /var/tmp/diff_new_pack.nOY4UD/_new  2019-09-13 15:05:14.133257792 +0200
@@ -19,23 +19,23 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-dephell-discover
-Version:        0.2.1
+Version:        0.2.8
 Release:        0
-Summary:        Module to find project modules and data files (packages and 
package_data for setup.py)
+Summary:        Module to find project modules and data files
 License:        MIT
 Group:          Development/Languages/Python
-Url:            https://github.com/dephell/dephell_discover
-Source:         
https://files.pythonhosted.org/packages/source/d/dephell-discover/dephell_discover-%{version}.tar.gz
+URL:            https://github.com/dephell/dephell_discover
+Source:         
https://files.pythonhosted.org/packages/source/d/dephell_discover/dephell_discover-%{version}.tar.gz
 BuildRequires:  %{python_module base >= 3.5}
 BuildRequires:  %{python_module setuptools}
+BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
+Requires:       python-attr
+BuildArch:      noarch
 # SECTION test requirements
 BuildRequires:  %{python_module attr}
+BuildRequires:  %{python_module pytest}
 # /SECTION
-BuildRequires:  fdupes
-Requires:       python-attr
-BuildArch:      noarch
-
 %python_subpackages
 
 %description
@@ -51,6 +51,9 @@
 %python_install
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
+%check
+%pytest
+
 %files %{python_files}
 %license LICENSE
 %doc README.md

++++++ dephell_discover-0.2.1.tar.gz -> dephell_discover-0.2.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_discover-0.2.1/PKG-INFO 
new/dephell_discover-0.2.8/PKG-INFO
--- old/dephell_discover-0.2.1/PKG-INFO 1970-01-01 01:00:00.000000000 +0100
+++ new/dephell_discover-0.2.8/PKG-INFO 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
-Name: dephell_discover
-Version: 0.2.1
+Name: dephell-discover
+Version: 0.2.8
 Summary: Find project modules and data files (packages and package_data for 
setup.py).
 Project-URL: Repository, https://github.com/dephell/dephell_discover
 Author: Gram
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_discover-0.2.1/dephell_discover/__init__.py 
new/dephell_discover-0.2.8/dephell_discover/__init__.py
--- old/dephell_discover-0.2.1/dephell_discover/__init__.py     2019-05-19 
14:54:08.000000000 +0200
+++ new/dephell_discover-0.2.8/dephell_discover/__init__.py     2019-07-15 
15:53:26.000000000 +0200
@@ -9,7 +9,7 @@
 from ._root import Root
 
 
-__version__ = '0.2.1'
+__version__ = '0.2.8'
 __author__ = 'Gram (@orsinium)'
 __license__ = 'MIT'
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_discover-0.2.1/dephell_discover/_line.py 
new/dephell_discover-0.2.8/dephell_discover/_line.py
--- old/dephell_discover-0.2.1/dephell_discover/_line.py        2019-05-18 
19:49:53.000000000 +0200
+++ new/dephell_discover-0.2.8/dephell_discover/_line.py        2019-07-15 
15:52:45.000000000 +0200
@@ -41,7 +41,7 @@
         if type(tree) is not ast.Module:
             return None
         # check is assigment
-        if type(tree.body[0]) is not ast.Assign:  # type: ignore
+        if not tree.body or type(tree.body[0]) is not ast.Assign:  # type: 
ignore
             return None
         # check is correct target
         target = tree.body[0].targets[0]  # type: ignore
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_discover-0.2.1/dephell_discover/_metainfo.py 
new/dephell_discover-0.2.8/dephell_discover/_metainfo.py
--- old/dephell_discover-0.2.1/dephell_discover/_metainfo.py    2019-05-18 
19:50:42.000000000 +0200
+++ new/dephell_discover-0.2.8/dephell_discover/_metainfo.py    2019-05-21 
17:04:15.000000000 +0200
@@ -67,18 +67,23 @@
 
     @cached_property
     def authors(self) -> List[str]:
+        # get authors
         authors = []
         for name in ('__author__', '__authors__', '__maintainer__', 
'__credits__'):
             some_authors = self._get_var(name=name)
             if some_authors:
                 authors.extend(some_authors.split(', '))
-        if authors:
-            for name in ('__email__', '__contact__'):
-                if '<' in authors[0]:
-                    continue
-                mail = self._get_var(name=name)
-                if mail:
-                    authors[0] = '{} <{}>'.format(authors[0], mail)
+        if not authors:
+            return []
+
+        # attach email
+        for name in ('__email__', '__contact__'):
+            if '<' in authors[0]:
+                break
+            mail = self._get_var(name=name)
+            if mail:
+                authors[0] = '{} <{}>'.format(authors[0], mail)
+
         return authors
 
     @cached_property
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_discover-0.2.1/dephell_discover/_root.py 
new/dephell_discover-0.2.8/dephell_discover/_root.py
--- old/dephell_discover-0.2.1/dephell_discover/_root.py        2019-05-18 
15:16:37.000000000 +0200
+++ new/dephell_discover-0.2.8/dephell_discover/_root.py        2019-07-15 
15:52:45.000000000 +0200
@@ -65,8 +65,8 @@
         for path in self.path.glob('**/*'):
             if not self.include(path=path):
                 continue
-            # skip dirs and python files
-            if not path.is_file() or path.suffix == '.py':
+            # skip dirs, python files and files without extension
+            if not path.is_file() or path.suffix in ('.py', ''):
                 continue
             data = self._make_data(path=path.parent, ext=path.suffix)
             if data is not None:
@@ -74,9 +74,14 @@
         return result
 
     @cached_property
-    def metainfo(self) -> MetaInfo:
-        path = self.packages[0].path
-        return MetaInfo.parse(paths=(path, ))
+    def metainfo(self) -> Optional[MetaInfo]:
+        if not self.packages:
+            return None
+        # get metainfo only from top-level packages
+        paths = [package.path for package in self.packages if '.' not in 
package.module]
+        if not paths:
+            paths = [self.packages[0].path]
+        return MetaInfo.parse(paths=paths)
 
     # public methods
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/dephell_discover-0.2.1/dephell_discover.egg-info/PKG-INFO 
new/dephell_discover-0.2.8/dephell_discover.egg-info/PKG-INFO
--- old/dephell_discover-0.2.1/dephell_discover.egg-info/PKG-INFO       
1970-01-01 01:00:00.000000000 +0100
+++ new/dephell_discover-0.2.8/dephell_discover.egg-info/PKG-INFO       
1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
-Name: dephell_discover
-Version: 0.2.1
+Name: dephell-discover
+Version: 0.2.8
 Summary: Find project modules and data files (packages and package_data for 
setup.py).
 Project-URL: Repository, https://github.com/dephell/dephell_discover
 Author: Gram
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/dephell_discover-0.2.1/dephell_discover.egg-info/SOURCES.txt 
new/dephell_discover-0.2.8/dephell_discover.egg-info/SOURCES.txt
--- old/dephell_discover-0.2.1/dephell_discover.egg-info/SOURCES.txt    
1970-01-01 01:00:00.000000000 +0100
+++ new/dephell_discover-0.2.8/dephell_discover.egg-info/SOURCES.txt    
1970-01-01 01:00:00.000000000 +0100
@@ -2,11 +2,11 @@
 README.rst
 setup.cfg
 setup.py
-dephell_discover/_data.py
-dephell_discover/_package.py
+dephell_discover/_constants.py
+dephell_discover/_cached_propery.py
 dephell_discover/_line.py
 dephell_discover/__init__.py
+dephell_discover/_package.py
 dephell_discover/_root.py
-dephell_discover/_cached_propery.py
-dephell_discover/_metainfo.py
-dephell_discover/_constants.py
\ No newline at end of file
+dephell_discover/_data.py
+dephell_discover/_metainfo.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/dephell_discover-0.2.1/dephell_discover.egg-info/requires.txt 
new/dephell_discover-0.2.8/dephell_discover.egg-info/requires.txt
--- old/dephell_discover-0.2.1/dephell_discover.egg-info/requires.txt   
1970-01-01 01:00:00.000000000 +0100
+++ new/dephell_discover-0.2.8/dephell_discover.egg-info/requires.txt   
1970-01-01 01:00:00.000000000 +0100
@@ -1 +1 @@
-attr
\ No newline at end of file
+attrs
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_discover-0.2.1/setup.py 
new/dephell_discover-0.2.8/setup.py
--- old/dephell_discover-0.2.1/setup.py 2019-05-19 14:54:17.000000000 +0200
+++ new/dephell_discover-0.2.8/setup.py 2019-07-15 15:53:45.000000000 +0200
@@ -13,22 +13,22 @@
 
 readme = ''
 here = os.path.abspath(os.path.dirname(__file__))
-with open(os.path.join(here, 'README.rst'), 'rb') as stream:
-    readme = stream.read().decode('utf8')
+readme_path = os.path.join(here, 'README.rst')
+if os.path.exists(readme_path):
+    with open(readme_path, 'rb') as stream:
+        readme = stream.read().decode('utf8')
 
 setup(
     long_description=readme,
     name='dephell_discover',
-    version='0.2.1',
-    description=
-    'Find project modules and data files (packages and package_data for 
setup.py).',
+    version='0.2.8',
+    description='Find project modules and data files (packages and 
package_data for setup.py).',
     python_requires='>=3.5',
     project_urls={'repository': 'https://github.com/dephell/dephell_discover'},
     author='Gram',
     author_email='[email protected]',
     license='MIT',
-    keywords=
-    'dephell packaging dependency dependencies setuptools packages finder',
+    keywords='dephell packaging dependency dependencies setuptools packages 
finder',
     classifiers=[
         'Development Status :: 4 - Beta', 'Environment :: Console',
         'Framework :: Setuptools Plugin', 'Intended Audience :: Developers',
@@ -38,5 +38,5 @@
     ],
     packages=['dephell_discover'],
     package_data={},
-    install_requires=['attr'],
+    install_requires=['attrs'],
 )
Binary files 
old/dephell_discover-0.2.1/tests/__pycache__/__init__.cpython-36.pyc and 
new/dephell_discover-0.2.8/tests/__pycache__/__init__.cpython-36.pyc differ
Binary files 
old/dephell_discover-0.2.1/tests/__pycache__/test_metainfo.cpython-36-PYTEST.pyc
 and 
new/dephell_discover-0.2.8/tests/__pycache__/test_metainfo.cpython-36-PYTEST.pyc
 differ
Binary files 
old/dephell_discover-0.2.1/tests/__pycache__/test_root.cpython-36-PYTEST.pyc 
and 
new/dephell_discover-0.2.8/tests/__pycache__/test_root.cpython-36-PYTEST.pyc 
differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_discover-0.2.1/tests/test_metainfo.py 
new/dephell_discover-0.2.8/tests/test_metainfo.py
--- old/dephell_discover-0.2.1/tests/test_metainfo.py   1970-01-01 
01:00:00.000000000 +0100
+++ new/dephell_discover-0.2.8/tests/test_metainfo.py   2019-05-21 
16:43:43.000000000 +0200
@@ -0,0 +1,29 @@
+from pathlib import Path
+
+import pytest
+
+from dephell_discover._metainfo import MetaInfo
+
+
[email protected]('content, name, expected', [
+    ('__license__ = "MIT"', 'license', 'MIT'),
+
+    ('__version__ = "0.2.7"', 'version', '0.2.7'),
+    ('__version__ = ("0", "2", "7")', 'version', '0.2.7'),
+    # ('__version__ = (0, 2, 7)', 'version', '0.2.7'),
+
+    ('__author__ = "Gram"', 'authors', ['Gram']),
+    ('__authors__ = ["Gram"]', 'authors', ['Gram']),
+
+])
+def test_vars(tmp_path: Path, content: str, name: str, expected):
+    path = tmp_path / 'lol.py'
+    path.write_text(content)
+    info = MetaInfo.parse(paths=[path])
+    assert getattr(info, name) == expected
+
+
+def test_summary():
+    path = Path('dephell_discover')
+    info = MetaInfo.parse(paths=[path])
+    assert info.summary == 'Discover python packages.'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_discover-0.2.1/tests/test_root.py 
new/dephell_discover-0.2.8/tests/test_root.py
--- old/dephell_discover-0.2.1/tests/test_root.py       1970-01-01 
01:00:00.000000000 +0100
+++ new/dephell_discover-0.2.8/tests/test_root.py       2019-05-21 
16:43:43.000000000 +0200
@@ -0,0 +1,121 @@
+from collections import defaultdict
+
+import pytest
+
+from dephell_discover import Root
+
+
+def test_discover_packages(tmp_path):
+    package = Root(path=tmp_path)
+    path = tmp_path / 'project1'
+
+    path.mkdir()
+    (path / 'dir1').mkdir()
+    (path / 'dir2').mkdir()
+    (path / 'dir3').mkdir()
+    (path / 'dir3' / 'dir4').mkdir()
+    (path / 'empty').mkdir()
+    (path / '__pycache__').mkdir()
+
+    (tmp_path / 'ignore.json').touch()
+    (path / '__init__.py').touch()
+    (path / 'file1.py').touch()
+    (path / 'file2.db').touch()
+    (path / 'dir1' / '__init__.py').touch()
+    (path / 'dir2' / 'file3.json').touch()
+
+    (path / 'dir3' / '__init__.py').touch()
+    (path / 'dir3' / 'dir4' / 'file4.json').touch()
+
+    (path / '__pycache__' / 'lol.pyc').touch()
+
+    assert set(map(str, package.packages)) == {'project1', 'project1.dir1', 
'project1.dir3'}
+
+    data = defaultdict(set)
+    for subpackage in package.data:
+        data[subpackage.module].add(str(subpackage))
+    assert set(data) == {'project1', 'project1.dir3'}
+    assert data['project1'] == {'*.db', 'dir2/*.json'}
+    assert data['project1.dir3'] == {'dir4/*.json'}
+
+
[email protected]('files, expected', [
+    [('foobar/__init__.py', 'foobar/foo.py', 'foobar/bar.py'), {'': ''}],
+    [('src/__init__.py', 'src/foo.py', 'src/bar.py'), {'foobar': 'src'}],
+    [('src/foo.py', 'src/bar.py'), {'': 'src'}],
+    [('__init__.py', 'foo.py', 'bar.py'), {'foobar': ''}],
+    [('src/foobar/__init__.py', 'src/foobar/foo.py', 'src/foobar/bar.py'), 
{'': 'src'}],
+])
+def test_package_dir(files, expected, tmp_path):
+    for file_path in files:
+        path = tmp_path.joinpath(file_path)
+        if '/' in file_path:
+            path.parent.mkdir(parents=True, exist_ok=True)
+        path.touch()
+
+    root = Root(path=tmp_path, name='foobar')
+    assert root.package_dir == expected
+
+
[email protected]('files, expected', [
+    [('foobar/__init__.py', 'foobar/foo.py', 'foobar/bar.py'), {'foobar/': 
'foobar'}],
+    [('src/__init__.py', 'src/foo.py', 'src/bar.py'), {'src/': 'foobar'}],
+    [('src/foo.py', 'src/bar.py'), {'src/': ''}],
+    [('__init__.py', 'foo.py', 'bar.py'), {'': 'foobar'}],
+    [('src/foobar/__init__.py', 'src/foobar/foo.py', 'src/foobar/bar.py'), 
{'src/foobar/': 'foobar'}],
+])
+def test_get_module_name(files, expected, tmp_path):
+    for file_path in files:
+        path = tmp_path.joinpath(file_path)
+        if '/' in file_path:
+            path.parent.mkdir(parents=True, exist_ok=True)
+        path.touch()
+
+    root = Root(path=tmp_path, name='foobar')
+    for file_path, module_name in expected.items():
+        assert root._get_module_name(path=tmp_path.joinpath(file_path)) == 
module_name
+
+
[email protected]('files, expected_modules', [
+    [('foobar/__init__.py', 'foobar/foo.py', 'foobar/bar.py'), {'foobar'}],
+    [('src/__init__.py', 'src/foo.py', 'src/bar.py'), {'foobar'}],
+    # [('src/foo.py', 'src/bar.py'), {''}],
+    [('__init__.py', 'foo.py', 'bar.py'), {'foobar'}],
+    [('src/foobar/__init__.py', 'src/foobar/foo.py', 'src/foobar/bar.py'), 
{'foobar'}],
+    [
+        ('src/foobar/__init__.py', 'src/foobar/foo.py', 
'src/foobar/sub/bar.py', 'src/foobar/sub/__init__.py'),
+        {'foobar', 'foobar.sub'},
+    ],
+])
+def test_packages_module(files, expected_modules, tmp_path):
+    for file_path in files:
+        path = tmp_path.joinpath(file_path)
+        if '/' in file_path:
+            path.parent.mkdir(parents=True, exist_ok=True)
+        path.touch()
+
+    root = Root(path=tmp_path, name='foobar')
+    assert len(root.packages) == len(expected_modules)
+    assert {package.module for package in root.packages} == expected_modules
+
+
[email protected]('files, expected_paths', [
+    [('foobar/__init__.py', 'foobar/foo.py', 'foobar/bar.py'), {'foobar'}],
+    [('src/__init__.py', 'src/foo.py', 'src/bar.py'), {'src'}],
+    # [('src/foo.py', 'src/bar.py'), {'src/'}],
+    [('__init__.py', 'foo.py', 'bar.py'), {''}],
+    [('src/foobar/__init__.py', 'src/foobar/foo.py', 'src/foobar/bar.py'), 
{'src/foobar'}],
+    [
+        ('src/foobar/__init__.py', 'src/foobar/foo.py', 
'src/foobar/sub/bar.py', 'src/foobar/sub/__init__.py'),
+        {'src/foobar', 'src/foobar/sub'},
+    ],
+])
+def test_packages_path(files, expected_paths, tmp_path):
+    for file_path in files:
+        path = tmp_path.joinpath(file_path)
+        if '/' in file_path:
+            path.parent.mkdir(parents=True, exist_ok=True)
+        path.touch()
+
+    root = Root(path=tmp_path, name='foobar')
+    assert {package.relative for package in root.packages} == expected_paths


Reply via email to