[Python-modules-commits] [checkbox-support] 02/10: Import checkbox-support-0.22.orig.tar.gz

Sylvain Pineau spineau-guest at moszumanska.debian.org
Mon Dec 7 13:08:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

spineau-guest pushed a commit to tag debian/0.22-1
in repository checkbox-support.

commit 532f9582ad80620bc1276d6b3908dd4402563504
Author: Sylvain Pineau <sylvain.pineau at canonical.com>
Date:   Mon Dec 7 13:35:00 2015 +0100

    Import checkbox-support-0.22.orig.tar.gz
---
 PKG-INFO                                           |  2 +-
 checkbox_support.egg-info/PKG-INFO                 |  2 +-
 checkbox_support.egg-info/SOURCES.txt              |  1 +
 checkbox_support.egg-info/entry_points.txt         | 12 +++----
 checkbox_support.egg-info/requires.txt             |  2 +-
 checkbox_support/parsers/pactl.py                  | 23 ++++++++-----
 checkbox_support/parsers/submission.py             | 40 ++++++++++++++++++++++
 .../tests/fixtures/submission_snap_packages.xml    | 12 +++++++
 checkbox_support/parsers/tests/test_pactl.py       | 14 ++++++++
 checkbox_support/parsers/tests/test_submission.py  | 16 +++++++++
 checkbox_support/parsers/udevadm.py                |  2 +-
 checkbox_support/scripts/audio_settings.py         |  2 +-
 checkbox_support/tests/__init__.py                 |  5 +--
 checkbox_support/vendor/mock.py                    |  2 ++
 setup.cfg                                          |  2 +-
 setup.py                                           |  2 +-
 16 files changed, 116 insertions(+), 23 deletions(-)

diff --git a/PKG-INFO b/PKG-INFO
index 5176ce0..41894fe 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: checkbox-support
-Version: 0.20
+Version: 0.22
 Summary: CheckBox support library
 Home-page: https://launchpad.net/checkbox/
 Author: Sylvain Pineau
diff --git a/checkbox_support.egg-info/PKG-INFO b/checkbox_support.egg-info/PKG-INFO
index 5176ce0..41894fe 100644
--- a/checkbox_support.egg-info/PKG-INFO
+++ b/checkbox_support.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: checkbox-support
-Version: 0.20
+Version: 0.22
 Summary: CheckBox support library
 Home-page: https://launchpad.net/checkbox/
 Author: Sylvain Pineau
diff --git a/checkbox_support.egg-info/SOURCES.txt b/checkbox_support.egg-info/SOURCES.txt
index 6d443c2..a4f7592 100644
--- a/checkbox_support.egg-info/SOURCES.txt
+++ b/checkbox_support.egg-info/SOURCES.txt
@@ -86,6 +86,7 @@ checkbox_support/parsers/tests/fixtures/submission_packages.xml
 checkbox_support/parsers/tests/fixtures/submission_packages_modaliases.xml
 checkbox_support/parsers/tests/fixtures/submission_processors.xml
 checkbox_support/parsers/tests/fixtures/submission_questions.xml
+checkbox_support/parsers/tests/fixtures/submission_snap_packages.xml
 checkbox_support/parsers/tests/fixtures/submission_udev.xml
 checkbox_support/parsers/tests/fixtures/submission_udev_armhf.xml
 checkbox_support/parsers/tests/fixtures/xinput_quantal.txt
diff --git a/checkbox_support.egg-info/entry_points.txt b/checkbox_support.egg-info/entry_points.txt
index 20c469e..41ebcea 100644
--- a/checkbox_support.egg-info/entry_points.txt
+++ b/checkbox_support.egg-info/entry_points.txt
@@ -1,13 +1,13 @@
 [plainbox.parsers]
-bto = checkbox_support.parsers.image_info:parse_bto_attachment_output
-buildstamp = checkbox_support.parsers.image_info:parse_buildstamp_attachment_output
 dkms-info = checkbox_support.parsers.dkms_info:parse_dkms_info
+pactl-list = checkbox_support.parsers.pactl:parse_pactl_output
 dmidecode = checkbox_support.parsers.dmidecode:parse_dmidecode_output
-modinfo = checkbox_support.parsers.modinfo:parse_modinfo_attachment_output
 modprobe = checkbox_support.parsers.modprobe:parse_modprobe_d_output
-pactl-list = checkbox_support.parsers.pactl:parse_pactl_output
-pci-subsys-id = checkbox_support.parsers.pci_config:parse_pci_subsys_id
+buildstamp = checkbox_support.parsers.image_info:parse_buildstamp_attachment_output
+bto = checkbox_support.parsers.image_info:parse_bto_attachment_output
+udevadm = checkbox_support.parsers.udevadm:parse_udevadm_output
 recovery-info = checkbox_support.parsers.image_info:parse_recovery_info_attachment_output
+modinfo = checkbox_support.parsers.modinfo:parse_modinfo_attachment_output
+pci-subsys-id = checkbox_support.parsers.pci_config:parse_pci_subsys_id
 submission = checkbox_support.parsers.submission:parse_submission_text
-udevadm = checkbox_support.parsers.udevadm:parse_udevadm_output
 
diff --git a/checkbox_support.egg-info/requires.txt b/checkbox_support.egg-info/requires.txt
index 5d23867..00c6c41 100644
--- a/checkbox_support.egg-info/requires.txt
+++ b/checkbox_support.egg-info/requires.txt
@@ -1,2 +1,2 @@
 lxml >= 2.3
-pyparsing >= 2.0.0
+pyparsing >= 2.0.0
\ No newline at end of file
diff --git a/checkbox_support/parsers/pactl.py b/checkbox_support/parsers/pactl.py
index 807e1cc..d73d808 100644
--- a/checkbox_support/parsers/pactl.py
+++ b/checkbox_support/parsers/pactl.py
@@ -351,14 +351,21 @@ AttributeName = p.Regex("[a-zA-Z][^:\n]+").setResultsName("attribute-name")
 VolumeAttributeValue = (
     p.Combine(
         p.Or([
-            p.Literal("(invalid)"),
-            p.Regex("([0-9]+: +[0-9]+% ?)+")
-        ])
-        + p.LineEnd()
-        + p.Optional(p.White('\t').suppress())
-        + p.Or([
-            p.Literal("(invalid)"),
-            p.Regex("([0-9]+: -?([0-9]+\.[0-9]+|inf) dB ?)+"),
+            p.Or([
+                p.Literal("(invalid)"),
+                p.Regex("([0-9]+: +[0-9]+% ?)+")
+            ])
+            + p.LineEnd()
+            + p.Optional(p.White('\t').suppress())
+            + p.Or([
+                p.Literal("(invalid)"),
+                p.Regex("([0-9]+: -?([0-9]+\.[0-9]+|inf) dB ?)+"),
+            ]),
+            p.Or([
+                p.Literal("(invalid)"),
+                p.Regex("([\w\-]+: [0-9]+ / +[0-9]+% /"
+                        " +-?([0-9]+\.[0-9]+|inf) dB,? *)+")
+            ])
         ])
         + p.LineEnd()
         + p.Optional(p.White('\t').suppress())
diff --git a/checkbox_support/parsers/submission.py b/checkbox_support/parsers/submission.py
index f499924..81e7503 100644
--- a/checkbox_support/parsers/submission.py
+++ b/checkbox_support/parsers/submission.py
@@ -304,6 +304,18 @@ class TestRun(object):
         logger.debug(package_version)
         message["packages"].append(package_version)
 
+    def addSnapPackageVersion(self, **snap_package_version):
+        if not self.messages or (self.messages[-1]["type"]
+                                != "set-snap-packages"):
+            self.messages.append({
+                "type": "set-snap-packages",
+                "snap-packages": []})
+
+        message = self.messages[-1]
+        logger.debug("ADDING Snap Package Version:")
+        logger.debug(snap_package_version)
+        message["snap-packages"].append(snap_package_version)
+
     def addTestResult(self, **test_result):
         if not self.messages or self.messages[-1]["type"] != "add-results":
             self.messages.append({
@@ -633,6 +645,8 @@ class SubmissionResult(object):
         register(("test_run", "raw_dmi_device",), self.addRawDmiDeviceState)
         register(("test_run", "distribution",), self.setDistribution)
         register(("test_run", "package_version",), self.addPackageVersion)
+        register(("test_run", "snap_package_version",),
+                 self.addSnapPackageVersion)
         register(("test_run", "test_result",), self.addTestResult)
         register(("test_run", "modprobe",), self.addModprobeInfo)
         register(("test_run", "dkms_info",), self.addDkmsInfo)
@@ -840,6 +854,19 @@ class SubmissionResult(object):
     def addPackageVersion(self, test_run, package_version):
         test_run.addPackageVersion(**package_version)
 
+    def addSnapPackage(self, snap_package):
+        snap_package_version = {
+            "name": snap_package["name"],
+            "date": snap_package["properties"]["date"],
+            "version": snap_package["properties"]["version"],
+            "developer": snap_package["properties"]["developer"],
+            }
+        self.dispatcher.publishEvent(
+            "snap_package_version", snap_package_version)
+
+    def addSnapPackageVersion(self, test_run, snap_package_version):
+        test_run.addSnapPackageVersion(**snap_package_version)
+
     def addQuestion(self, question):
         answer_to_status = {
             "fail": FAIL,
@@ -1084,6 +1111,18 @@ class SubmissionParser(object):
                 }
             result.addPackage(package)
 
+    def parseSnapPackages(self, result, node):
+        """Parse the <snap_packages> part of a submission."""
+        for child in node.getchildren():
+            assert child.tag == "snap_package", \
+                "Unexpected tag <%s>, expected <snap_package>" % child.tag
+
+            snap_package = {
+                "name": child.get("name"),
+                "properties": self._getProperties(child),
+                }
+            result.addSnapPackage(snap_package)
+
     def parseProcessors(self, result, node):
         """Parse the <processors> part of a submission."""
         processors = []
@@ -1179,6 +1218,7 @@ class SubmissionParser(object):
         parsers = {
             "lsbrelease": self.parseLSBRelease,
             "packages": self.parsePackages,
+            "snap_packages": self.parseSnapPackages,
             }
 
         for child in node.getchildren():
diff --git a/checkbox_support/parsers/tests/fixtures/submission_snap_packages.xml b/checkbox_support/parsers/tests/fixtures/submission_snap_packages.xml
new file mode 100644
index 0000000..bbd10a6
--- /dev/null
+++ b/checkbox_support/parsers/tests/fixtures/submission_snap_packages.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+<system version="1.0">
+<software>
+<snap_packages>
+<snap_package id="0" name="ubuntu-core">
+<property name="date" type="str">2015-10-13</property>
+<property name="version" type="str">14</property>
+<property name="developer" type="str">ubuntu</property>
+</snap_package>
+</snap_packages>
+</software>
+</system>
diff --git a/checkbox_support/parsers/tests/test_pactl.py b/checkbox_support/parsers/tests/test_pactl.py
index 1b3897a..1951708 100644
--- a/checkbox_support/parsers/tests/test_pactl.py
+++ b/checkbox_support/parsers/tests/test_pactl.py
@@ -357,6 +357,20 @@ class AttributeTests(ParsingTestCase):
             '0: -13.40 dB 1: -13.40 dB\n'
             'balance 0.00\n'))
 
+    def test_volume_variant1(self):
+        # pactl Volume properties differ with recent PulseAudio versions
+        attr = self.assertParses(
+            pactl.GenericSimpleAttribute.Syntax, (
+                'Volume: front-left: 52428 /  80% / -5.81 dB,   '
+                'front-right: 52428 /  80% / -5.81 dB\n'
+                '         balance 0.00\n')
+        )['attribute']
+        self.assertEqual(attr.name, 'Volume')
+        self.assertEqual(attr.value, (
+            'front-left: 52428 /  80% / -5.81 dB,   '
+            'front-right: 52428 /  80% / -5.81 dB\n'
+            'balance 0.00\n'))
+
     def test_inf_volume(self):
         # LP: 1350168
         attr = self.assertParses(
diff --git a/checkbox_support/parsers/tests/test_submission.py b/checkbox_support/parsers/tests/test_submission.py
index 9f9f362..268aa25 100644
--- a/checkbox_support/parsers/tests/test_submission.py
+++ b/checkbox_support/parsers/tests/test_submission.py
@@ -94,6 +94,10 @@ class SubmissionRun(object):
         self.result.setdefault("package_versions", [])
         self.result["package_versions"].append(package_version)
 
+    def addSnapPackageVersion(self, **snap_package_version):
+        self.result.setdefault("snap_package_versions", [])
+        self.result["snap_package_versions"].append(snap_package_version)
+
     def addTestResult(self, **test_result):
         self.result.setdefault("test_results", [])
         self.result["test_results"].append(test_result)
@@ -330,6 +334,18 @@ class TestSubmissionParser(TestCase):
         self.assertEqual(package_version["name"], "accountsservice")
         self.assertEqual(package_version["version"], "0.6.21-6ubuntu2")
 
+    def test_snap_package_versions(self):
+        """Snap Package versions are in the snap_packages element."""
+        result = self.getResult("submission_snap_packages.xml")
+        self.assertTrue("snap_package_versions" in result)
+        self.assertEqual(len(result["snap_package_versions"]), 1)
+
+        package_version = result["snap_package_versions"][0]
+        self.assertEqual(package_version["name"], "ubuntu-core")
+        self.assertEqual(package_version["version"], "14")
+        self.assertEqual(package_version["date"], "2015-10-13")
+        self.assertEqual(package_version["developer"], "ubuntu")
+
     def test_package_modaliases(self):
         """
         Modaliases information is in the packages element if a package
diff --git a/checkbox_support/parsers/udevadm.py b/checkbox_support/parsers/udevadm.py
index e9d126f..cb9e3dd 100644
--- a/checkbox_support/parsers/udevadm.py
+++ b/checkbox_support/parsers/udevadm.py
@@ -803,7 +803,7 @@ class UdevadmParser(object):
                     self.devices[device._raw_path] = device
             stack.append(device)
 
-        for device in self.devices.values():
+        for device in list(self.devices.values()):
             if device.category in ("NETWORK", "WIRELESS", "OTHER"):
                 dev_interface = [
                     d for d in self.devices.values()
diff --git a/checkbox_support/scripts/audio_settings.py b/checkbox_support/scripts/audio_settings.py
index 4c55973..ea1fd8a 100644
--- a/checkbox_support/scripts/audio_settings.py
+++ b/checkbox_support/scripts/audio_settings.py
@@ -38,7 +38,7 @@ DIRECTIONS = {"source": "input", "sink": "output"}
 default_pattern = "(?<=Default %s: ).*"
 index_regex = re.compile("(?<=index: )[0-9]*")
 muted_regex = re.compile("(?<=Mute: ).*")
-volume_regex = re.compile("Volume: (?:0|front-left):\s*([0-9])*")
+volume_regex = re.compile("Volume: (?:0|front-left):\s*([0-9]*)")
 name_regex = re.compile("(?<=Name:).*")
 
 entry_pattern = "Name: %s.*?(?=Properties)"
diff --git a/checkbox_support/tests/__init__.py b/checkbox_support/tests/__init__.py
index fe0bf3d..2ade626 100644
--- a/checkbox_support/tests/__init__.py
+++ b/checkbox_support/tests/__init__.py
@@ -40,8 +40,9 @@ def load_unit_tests():
     """
     # Discover all unit tests. By simple convention those are kept in
     # python modules that start with the word 'test_' .
-    return defaultTestLoader.discover(
-        os.path.dirname(getabsfile(checkbox_support)))
+    start_dir = os.path.dirname(getabsfile(checkbox_support))
+    top_level_dir = os.path.normpath(os.path.join(start_dir, '..'))
+    return defaultTestLoader.discover(start_dir, top_level_dir=top_level_dir)
 
 
 def test_suite():
diff --git a/checkbox_support/vendor/mock.py b/checkbox_support/vendor/mock.py
index c8fc5d1..ca77df6 100644
--- a/checkbox_support/vendor/mock.py
+++ b/checkbox_support/vendor/mock.py
@@ -658,6 +658,8 @@ class NonCallableMock(Base):
                 raise AttributeError("Mock object has no attribute %r" % name)
         elif _is_magic(name):
             raise AttributeError(name)
+        if name.startswith(('assert', 'assret')):
+            raise AttributeError(name)
 
         result = self._mock_children.get(name)
         if result is _deleted:
diff --git a/setup.cfg b/setup.cfg
index 6a2d7af..a98a913 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -2,7 +2,7 @@
 sign = True
 
 [egg_info]
+tag_build = 
 tag_date = 0
 tag_svn_revision = 0
-tag_build = 
 
diff --git a/setup.py b/setup.py
index 08547f8..d47b252 100755
--- a/setup.py
+++ b/setup.py
@@ -38,7 +38,7 @@ with open(os.path.join(base_dir, "README.rst"), encoding="UTF-8") as stream:
 
 setup(
     name="checkbox-support",
-    version="0.20",
+    version="0.22",
     url="https://launchpad.net/checkbox/",
     packages=find_packages(),
     test_suite='checkbox_support.tests.test_suite',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/checkbox-support.git



More information about the Python-modules-commits mailing list