diff --git a/numericalunits-1.22-py2.py3-none-any.whl b/numericalunits-1.22-py2.py3-none-any.whl deleted file mode 100644 index 457000c..0000000 --- a/numericalunits-1.22-py2.py3-none-any.whl +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:76c95de0a72fed26e40758bb45b610610abc0102770620c749b3222dc55a63e3 -size 13065 diff --git a/numericalunits-1.22.tar.gz b/numericalunits-1.22.tar.gz new file mode 100644 index 0000000..46ffd7a --- /dev/null +++ b/numericalunits-1.22.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bfbdaba9226b6439df4a9a3bae93c36b201ec8d4cb5ae4d561ee9b2797d0391f +size 13180 diff --git a/python-numericalunits.changes b/python-numericalunits.changes index a1104f1..0d88055 100644 --- a/python-numericalunits.changes +++ b/python-numericalunits.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon May 20 01:13:20 UTC 2019 - John Vandenberg + +- Use GitHub tagged archive and post-release tests.py to add + %doc and %check + ------------------------------------------------------------------- Sat Dec 22 02:03:50 UTC 2018 - Todd R diff --git a/python-numericalunits.spec b/python-numericalunits.spec index e7f72b1..0c8a522 100644 --- a/python-numericalunits.spec +++ b/python-numericalunits.spec @@ -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 @@ Summary: Python module for defining quantities with units 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 @@ way with unique advantages: * 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.* diff --git a/tests.py b/tests.py new file mode 100644 index 0000000..a5bd15e --- /dev/null +++ b/tests.py @@ -0,0 +1,35 @@ +# -*- 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()