[Pkg-mpd-commits] [python-mpd] 05/91: Reorganize package structure. Use coverage in tox.ini
Simon McVittie
smcv at debian.org
Sat Feb 24 14:55:26 UTC 2018
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository python-mpd.
commit ab79042311b45f96332e3bd568e60ebeae84a2b6
Author: Robert Niederreiter <office at squarewave.at>
Date: Thu Aug 25 09:08:31 2016 +0200
Reorganize package structure. Use coverage in tox.ini
---
.gitignore | 26 ++++++++++++++------------
.travis.yml | 2 +-
mpd/__init__.py | 29 +++++++++++++++++++++++++++++
mpd.py => mpd/base.py | 2 ++
mpd_test.py => mpd/tests.py | 2 +-
setup.cfg | 5 ++++-
setup.py | 31 ++++++++++++++++++++++---------
tox.ini | 12 ++++++++++--
8 files changed, 83 insertions(+), 26 deletions(-)
diff --git a/.gitignore b/.gitignore
index 369eae1..95c3252 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,19 +3,20 @@
# Packages
*.egg
*.egg-info
-/dist
-/build
-/eggs
-/parts
-/bin
-/var
-/sdist
-/develop-eggs
+/.eggs/
+/dist/
+/build/
+/eggs/
+/parts/
+/bin/
+/var/
+/sdist/
+/develop-eggs/
+/lib/
+/lib64/
+/include/
+/local/
/.installed.cfg
-/lib
-/lib64
-/include
-/local
# Installer logs
/pip-selfcheck.json
@@ -25,6 +26,7 @@
/.coverage
/.tox
/nosetests.xml
+/coverage_html/
# Sphinx docs
/doc/_build
diff --git a/.travis.yml b/.travis.yml
index fc3a1b0..420e7a2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,4 +9,4 @@ python:
- "3.5"
- "pypy"
-script: python mpd_test.py
+script: python -m unittest mpd.tests
diff --git a/mpd/__init__.py b/mpd/__init__.py
new file mode 100644
index 0000000..d9a1b53
--- /dev/null
+++ b/mpd/__init__.py
@@ -0,0 +1,29 @@
+# python-mpd2: Python MPD client library
+#
+# Copyright (C) 2008-2010 J. Alexander Treuman <jat at spatialrift.net>
+# Copyright (C) 2012 J. Thalheim <jthalheim at gmail.com>
+# Copyright (C) 2016 Robert Niederreiter <rnix at squarewave.at>
+#
+# python-mpd2 is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# python-mpd2 is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with python-mpd2. If not, see <http://www.gnu.org/licenses/>.
+
+from mpd.base import CommandError
+from mpd.base import CommandListError
+from mpd.base import ConnectionError
+from mpd.base import IteratingError
+from mpd.base import MPDClient
+from mpd.base import MPDError
+from mpd.base import PendingCommandError
+from mpd.base import ProtocolError
+from mpd.base import VERSION
+
diff --git a/mpd.py b/mpd/base.py
similarity index 99%
rename from mpd.py
rename to mpd/base.py
index 7932693..64c1082 100644
--- a/mpd.py
+++ b/mpd/base.py
@@ -1,6 +1,8 @@
# python-mpd2: Python MPD client library
+#
# Copyright (C) 2008-2010 J. Alexander Treuman <jat at spatialrift.net>
# Copyright (C) 2012 J. Thalheim <jthalheim at gmail.com>
+# Copyright (C) 2016 Robert Niederreiter <rnix at squarewave.at>
#
# python-mpd2 is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
diff --git a/mpd_test.py b/mpd/tests.py
similarity index 99%
rename from mpd_test.py
rename to mpd/tests.py
index ee588f0..908d72c 100755
--- a/mpd_test.py
+++ b/mpd/tests.py
@@ -39,7 +39,7 @@ class TestMPDClient(unittest.TestCase):
longMessage = True
def setUp(self):
- self.socket_patch = mock.patch("mpd.socket")
+ self.socket_patch = mock.patch("mpd.base.socket")
self.socket_mock = self.socket_patch.start()
self.socket_mock.getaddrinfo.return_value = [range(5)]
diff --git a/setup.cfg b/setup.cfg
index 058a83e..a7e49de 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,5 @@
[sdist]
-formats=bztar,gztar,zip
+formats = bztar,gztar,zip
[build_sphinx]
source-dir = doc/
@@ -8,3 +8,6 @@ all_files = 1
[upload_sphinx]
upload-dir = doc/_build/html
+
+[easy_install]
+
diff --git a/setup.py b/setup.py
index 3e6a863..9c75b25 100644
--- a/setup.py
+++ b/setup.py
@@ -1,14 +1,20 @@
#! /usr/bin/env python
-from distutils.core import setup
from setuptools import Extension
+from setuptools import find_packages
+from setuptools import setup
from setuptools.command.test import test as TestCommand
-import sys,os
import mpd
+import os
+import sys
+
if sys.version_info[0] == 2:
from io import open
+
+VERSION = ".".join(map(str, mpd.VERSION))
+
CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
@@ -23,6 +29,7 @@ CLASSIFIERS = [
LICENSE = """\
Copyright (C) 2008-2010 J. Alexander Treuman <jat at spatialrift.net>
Copyright (C) 2012 J. Thalheim <joerg at higgsboson.tk>
+Copyright (C) 2016 Robert Niederreiter <rnix at squarewave.at>
python-mpd2 is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
@@ -36,37 +43,43 @@ GNU Lesser General Public License for more details. You should have received a
along with python-mpd2. If not, see <http://www.gnu.org/licenses/>.\
"""
+
class Tox(TestCommand):
+
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
+
def run_tests(self):
#import here, cause outside the eggs aren't loaded
import tox
errno = tox.cmdline(self.test_args)
sys.exit(errno)
+
def read(fname):
- return open(os.path.join(os.path.dirname(__file__), fname), encoding="utf8").read()
+ with open(os.path.join(os.path.dirname(__file__), fname),
+ encoding="utf8") as fd:
+ return fd.read()
-VERSION = ".".join(map(str, mpd.VERSION))
setup(
name="python-mpd2",
version=VERSION,
description="A Python MPD client library",
long_description=read('README.rst'),
+ classifiers=CLASSIFIERS,
author="J. Thalheim",
author_email="jthalheim at gmail.com",
+ license="GNU Lesser General Public License v3 (LGPLv3)",
url="https://github.com/Mic92/python-mpd2",
- download_url="https://github.com/Mic92/python-mpd2/archive/v%s.zip" % VERSION,
- py_modules=["mpd", "mpd_test"],
- classifiers=CLASSIFIERS,
- #license=LICENSE,
+ packages=find_packages(),
+ zip_safe=True,
keywords=["mpd"],
+ test_suite="mpd.tests",
tests_require=['tox'],
- cmdclass = {'test': Tox},
+ cmdclass={'test': Tox}
)
# vim: set expandtab shiftwidth=4 softtabstop=4 textwidth=79:
diff --git a/tox.ini b/tox.ini
index a62e2f9..94666aa 100644
--- a/tox.ini
+++ b/tox.ini
@@ -3,9 +3,17 @@ envlist = py26,py27,py32,py33,py34,py35,pypy
[testenv]
deps = mock
-commands = python mpd_test.py
+ coverage
+commands = coverage erase
+ coverage run mpd/tests.py
+ coverage report
+ coverage html -d coverage_html/{envname}
[testenv:py26]
deps = mock
unittest2
-commands = python mpd_test.py
+ coverage
+commands = coverage erase
+ coverage run mpd/tests.py
+ coverage report
+ coverage html -d coverage_html/{envname}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/python-mpd.git
More information about the Pkg-mpd-commits
mailing list