Hello community,

here is the log from the commit of package python-numericalunits for 
openSUSE:Factory checked in at 2019-05-21 10:41:14
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-numericalunits (Old)
 and      /work/SRC/openSUSE:Factory/.python-numericalunits.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-numericalunits"

Tue May 21 10:41:14 2019 rev:3 rq:704278 version:1.22

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-numericalunits/python-numericalunits.changes  
    2019-01-05 14:42:27.208475388 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-numericalunits.new.5148/python-numericalunits.changes
    2019-05-21 10:41:15.579052996 +0200
@@ -1,0 +2,6 @@
+Mon May 20 01:13:20 UTC 2019 - John Vandenberg <[email protected]>
+
+- Use GitHub tagged archive and post-release tests.py to add
+  %doc and %check
+
+-------------------------------------------------------------------

Old:
----
  numericalunits-1.22-py2.py3-none-any.whl

New:
----
  numericalunits-1.22.tar.gz
  tests.py

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

Other differences:
------------------
++++++ python-numericalunits.spec ++++++
--- /var/tmp/diff_new_pack.GE3cNF/_old  2019-05-21 10:41:16.779052217 +0200
+++ /var/tmp/diff_new_pack.GE3cNF/_new  2019-05-21 10:41:16.791052209 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-numericalunits
 #
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -24,9 +24,9 @@
 License:        MIT
 Group:          Development/Languages/Python
 Url:            http://pypi.python.org/pypi/numericalunits
-Source:         
https://files.pythonhosted.org/packages/py2.py3/n/numericalunits/numericalunits-%{version}-py2.py3-none-any.whl
-BuildRequires:  %{python_module devel}
-BuildRequires:  %{python_module pip}
+Source:         
https://github.com/sbyrnes321/numericalunits/archive/numericalunits-%{version}.tar.gz#/numericalunits-%{version}.tar.gz
+Source1:        
https://raw.githubusercontent.com/sbyrnes321/numericalunits/master/tests/tests.py
+BuildRequires:  %{python_module setuptools}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
 BuildArch:      noarch
@@ -44,21 +44,23 @@
 * Zero calculation overhead
 
 %prep
-%setup -T -c -n numericalunits-%{version}
+%setup -q -n numericalunits-numericalunits-%{version}
+cp %{SOURCE1} .
 
 %build
-# Not needed
+%python_build
 
 %install
-%python_expand pip%{$python_bin_suffix} install --root %{buildroot} %{SOURCE0}
+%python_install
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
 %check
-# todo
+%python_exec setup.py test --test-suite=tests
 
 %files %{python_files}
-%license %{python_sitelib}/numericalunits-%{version}.dist-info/LICENSE.txt
-%{python_sitelib}/numericalunits-%{version}.dist-info/
+%license LICENSE.txt
+%doc Changes.txt README.rst
+%{python_sitelib}/numericalunits-%{version}*egg-info/
 %{python_sitelib}/numericalunits.py*
 %pycache_only %{python_sitelib}/__pycache__/numericalunits.*
 

++++++ tests.py ++++++
# -*- coding: utf-8 -*-
"""
very basic tests on numericalunits
"""
import unittest
import numericalunits as nu

class TestStuff(unittest.TestCase):

    def setUp(self):
        pass

    def assert_almost_equal(self, a, b, rtol):
        """helper function to check if two floats are approximately equal,
        allowing for rounding errors etc. Similar to math.isclose in py3."""
        self.assertTrue(abs(a-b) <= rtol * (abs(a) + abs(b)))

    def test_everything(self):
        """just some very basic smoke tests"""
                # example from README
        x = 5 * nu.mL
        self.assert_almost_equal(x, 5e21 * nu.nm**3, rtol=1e-9)

        # example from README
        Efield = 1e5 * (nu.V / nu.cm)
        force = nu.e * Efield
        accel = force / nu.me
        self.assert_almost_equal(accel, 1.75882002e18 * nu.m / nu.s**2, 
rtol=1e-6)

        # make sure reset_units('SI') works
        nu.reset_units('SI')
        self.assert_almost_equal(nu.G, 1e-4, rtol=1e-9)

if __name__ == '__main__':
    unittest.main()

Reply via email to