Accepting request 1109157 from devel:languages:python
- Stop patching files that we ship directly, therefore * Remove patch fix-tests.patch * Remove patch use_unittest.patch - Switch to pyproject, autosetup and pyunittest macros. - Add patch remove-future-requirement.patch, remove requirement of future OBS-URL: https://build.opensuse.org/request/show/1109157 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-ana?expand=0&rev=7
This commit is contained in:
commit
f7010b96bd
@ -1,30 +0,0 @@
|
||||
From b8338bc7a6517a57ddd1537490be8b7023617104 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Garcia Moreno <daniel.garcia@suse.com>
|
||||
Date: Wed, 25 Jan 2023 11:01:30 +0100
|
||||
Subject: [PATCH] Fix tests: Do not test different id in test_dir
|
||||
|
||||
Looks like the python interpreter uses the same id if it's available, so
|
||||
this test fails randomly, depending on memory management.
|
||||
|
||||
".../ana-0.06/test.py", line 113, in test_dir
|
||||
self.assertNotEqual(old_id, id(two))
|
||||
AssertionError: 140642905866320 == 140642905866320
|
||||
|
||||
This patch just removes the check because we cannot be sure that they
|
||||
are different.
|
||||
---
|
||||
test.py | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/test.py b/test.py
|
||||
index 8c5f9ee..1250c34 100644
|
||||
--- a/test.py
|
||||
+++ b/test.py
|
||||
@@ -110,7 +110,6 @@ def test_dir(self):
|
||||
ana.dl = ana.DirDataLayer(pickle_dir="/tmp/test_ana")
|
||||
two = A.ana_load(uuid)
|
||||
self.assertEquals(uuid, two.ana_uuid)
|
||||
- self.assertNotEqual(old_id, id(two))
|
||||
|
||||
# reset the datalayer to make sure we handle it properly
|
||||
ana.set_dl(ana.DictDataLayer())
|
@ -1,3 +1,12 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Sep 6 03:05:47 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Stop patching files that we ship directly, therefore
|
||||
* Remove patch fix-tests.patch
|
||||
* Remove patch use_unittest.patch
|
||||
- Switch to pyproject, autosetup and pyunittest macros.
|
||||
- Add patch remove-future-requirement.patch, remove requirement of future
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 25 11:30:57 UTC 2023 - Daniel Garcia <daniel.garcia@suse.com>
|
||||
|
||||
|
@ -22,21 +22,18 @@ Version: 0.06
|
||||
Release: 0
|
||||
Summary: The Python "ana" module
|
||||
License: BSD-2-Clause
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/zardus/ana
|
||||
Source: https://files.pythonhosted.org/packages/source/a/ana/ana-%{version}.tar.gz
|
||||
# https://github.com/zardus/ana/issues/13
|
||||
Source2: https://raw.githubusercontent.com/zardus/ana/master/test.py
|
||||
Source2: test.py
|
||||
Source3: https://raw.githubusercontent.com/zardus/ana/master/test_pickle.p
|
||||
# https://github.com/zardus/ana/pull/14
|
||||
Patch0: use_unittest.patch
|
||||
# https://github.com/zardus/ana/pull/15
|
||||
Patch1: fix-tests.patch
|
||||
BuildRequires: %{python_module future}
|
||||
# https://github.com/zardus/ana/commit/7f3c0dd8bd9ed89e3e146f934212516831147c51
|
||||
Patch0: remove-future-requirement.patch
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: python-rpm-macros
|
||||
Requires: python-future
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
@ -44,21 +41,19 @@ BuildArch: noarch
|
||||
A Python module that provides an undocumented data layer for Python objects.
|
||||
|
||||
%prep
|
||||
%setup -q -n ana-%{version}
|
||||
[ -e test.py ] || cp %{SOURCE2} test.py
|
||||
[ -e test_pickle.p ] || cp %{SOURCE3} test_pickle.p
|
||||
%patch0
|
||||
%patch1 -p1
|
||||
%autosetup -p1 -n ana-%{version}
|
||||
cp %{SOURCE2} test.py
|
||||
cp %{SOURCE3} test_pickle.p
|
||||
|
||||
%build
|
||||
%python_build
|
||||
%pyproject_wheel
|
||||
|
||||
%install
|
||||
%python_install
|
||||
%pyproject_install
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
%python_exec -m unittest discover
|
||||
%pyunittest discover
|
||||
|
||||
%files %{python_files}
|
||||
%license LICENSE
|
||||
|
52
remove-future-requirement.patch
Normal file
52
remove-future-requirement.patch
Normal file
@ -0,0 +1,52 @@
|
||||
From 7f3c0dd8bd9ed89e3e146f934212516831147c51 Mon Sep 17 00:00:00 2001
|
||||
From: Lumir Balhar <lbalhar@redhat.com>
|
||||
Date: Mon, 31 Jul 2023 16:33:40 +0200
|
||||
Subject: [PATCH] Remove dependency on future
|
||||
|
||||
Fixes: https://github.com/zardus/ana/issues/16
|
||||
---
|
||||
ana/storable.py | 8 +++-----
|
||||
setup.py | 2 +-
|
||||
2 files changed, 4 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/ana/storable.py b/ana/storable.py
|
||||
index a11710b..37379b1 100644
|
||||
--- a/ana/storable.py
|
||||
+++ b/ana/storable.py
|
||||
@@ -1,5 +1,3 @@
|
||||
-from future.utils import iteritems
|
||||
-from past.builtins import long, unicode
|
||||
import uuid as uuid_module
|
||||
|
||||
import logging
|
||||
@@ -48,11 +46,11 @@ def ana_load(cls, uuid):
|
||||
def _any_to_literal(o, known_set, objects):
|
||||
if o is None:
|
||||
return None
|
||||
- elif type(o) in (long, int, str, unicode, float, bool):
|
||||
+ elif type(o) in (int, str, float, bool):
|
||||
return o
|
||||
elif isinstance(o, dict):
|
||||
return {
|
||||
- Storable._any_to_literal(k, known_set, objects):Storable._any_to_literal(v, known_set, objects) for k,v in iteritems(o)
|
||||
+ Storable._any_to_literal(k, known_set, objects):Storable._any_to_literal(v, known_set, objects) for k,v in o.items()
|
||||
}
|
||||
elif isinstance(o, list) or isinstance(o, tuple) or isinstance(o, set):
|
||||
return [ Storable._any_to_literal(e, known_set, objects) for e in o ]
|
||||
@@ -108,7 +106,7 @@ def _ana_getstate(self):
|
||||
return { k: getattr(self, k) for k in self._all_slots() if hasattr(self, k) }
|
||||
|
||||
def _ana_setstate(self, s):
|
||||
- for k,v in iteritems(s):
|
||||
+ for k,v in s.items():
|
||||
setattr(self, k, v)
|
||||
|
||||
def _ana_getliteral(self):
|
||||
diff --git a/setup.py b/setup.py
|
||||
index f574ef5..291104b 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -1,2 +1,2 @@
|
||||
from distutils.core import setup
|
||||
-setup(name='ana', version='0.06', install_requires=['future'], packages=['ana'])
|
||||
+setup(name='ana', version='0.06', packages=['ana'])
|
63
test.py
63
test.py
@ -1,7 +1,7 @@
|
||||
import os
|
||||
import gc
|
||||
import ana
|
||||
import nose
|
||||
import unittest
|
||||
import pickle
|
||||
|
||||
import logging
|
||||
@ -9,8 +9,6 @@ l = logging.getLogger("ana.test")
|
||||
|
||||
class A(ana.Storable):
|
||||
def __init__(self, n):
|
||||
nose.tools.assert_false(hasattr(self, 'n'))
|
||||
|
||||
self.n = n
|
||||
l.debug("%s.__init__", self)
|
||||
|
||||
@ -28,7 +26,8 @@ class A(ana.Storable):
|
||||
def _ana_getliteral(self):
|
||||
return { 'n': self.n }
|
||||
|
||||
def test_simple():
|
||||
class TestAna(unittest.TestCase):
|
||||
def test_simple(self):
|
||||
ana.set_dl(ana.SimpleDataLayer())
|
||||
one = A(1)
|
||||
one.make_uuid()
|
||||
@ -43,12 +42,12 @@ def test_simple():
|
||||
|
||||
assert pickle.load(open(os.path.join(os.path.dirname(__file__), 'test_pickle.p'), 'rb')).n == 1337
|
||||
|
||||
def write_a1337():
|
||||
def write_a1337(self):
|
||||
a1337 = A(1337)
|
||||
a1337.make_uuid()
|
||||
pickle.dump(a1337, open(os.path.join(os.path.dirname(__file__), 'test_pickle.p'), 'w'))
|
||||
|
||||
def test_dict():
|
||||
def test_dict(self):
|
||||
ana.set_dl(ana.DictDataLayer())
|
||||
l.debug("Initializing 1")
|
||||
one = A(1)
|
||||
@ -64,15 +63,15 @@ def test_dict():
|
||||
two_p = pickle.dumps(two)
|
||||
two_copy = pickle.loads(two_p)
|
||||
|
||||
nose.tools.assert_is(one_copy, one)
|
||||
nose.tools.assert_is_not(two_copy, two)
|
||||
nose.tools.assert_equal(str(two_copy), str(two))
|
||||
self.assertIs(one_copy, one)
|
||||
self.assertIsNot(two_copy, two)
|
||||
self.assertEqual(str(two_copy), str(two))
|
||||
|
||||
nose.tools.assert_is(one, A.ana_load(one.ana_store()))
|
||||
nose.tools.assert_is(two, A.ana_load(two.ana_store()))
|
||||
self.assertIs(one, A.ana_load(one.ana_store()))
|
||||
self.assertIs(two, A.ana_load(two.ana_store()))
|
||||
|
||||
two_copy2 = pickle.loads(pickle.dumps(two))
|
||||
nose.tools.assert_equal(str(two_copy2), str(two))
|
||||
self.assertEqual(str(two_copy2), str(two))
|
||||
|
||||
l.debug("Initializing 3")
|
||||
three = A(3)
|
||||
@ -82,27 +81,27 @@ def test_dict():
|
||||
l.debug("Deleting 3")
|
||||
del three
|
||||
gc.collect()
|
||||
nose.tools.assert_false(three_uuid in ana.get_dl().uuid_cache)
|
||||
self.assertFalse(three_uuid in ana.get_dl().uuid_cache)
|
||||
l.debug("Loading 3")
|
||||
three_copy = A.ana_load(three_uuid)
|
||||
nose.tools.assert_equal(three_copy.ana_uuid, three_uuid) #pylint:disable=no-member
|
||||
nose.tools.assert_equal(str(three_copy), three_str)
|
||||
self.assertEqual(three_copy.ana_uuid, three_uuid) #pylint:disable=no-member
|
||||
self.assertEqual(str(three_copy), three_str)
|
||||
|
||||
known = set()
|
||||
first_json = three_copy.to_literal(known)
|
||||
nose.tools.assert_true(three_copy.ana_uuid in first_json['objects'])
|
||||
nose.tools.assert_equal(first_json['objects'][three_copy.ana_uuid]['object']['n'], three_copy.n)
|
||||
nose.tools.assert_equal(first_json['value']['ana_uuid'], three_copy.ana_uuid)
|
||||
self.assertTrue(three_copy.ana_uuid in first_json['objects'])
|
||||
self.assertEqual(first_json['objects'][three_copy.ana_uuid]['object']['n'], three_copy.n)
|
||||
self.assertEqual(first_json['value']['ana_uuid'], three_copy.ana_uuid)
|
||||
|
||||
second_json = three_copy.to_literal(known)
|
||||
nose.tools.assert_false(three_copy.ana_uuid in second_json['objects'])
|
||||
nose.tools.assert_equal(second_json['value']['ana_uuid'], three_copy.ana_uuid)
|
||||
self.assertFalse(three_copy.ana_uuid in second_json['objects'])
|
||||
self.assertEqual(second_json['value']['ana_uuid'], three_copy.ana_uuid)
|
||||
|
||||
def test_dir():
|
||||
def test_dir(self):
|
||||
ana.dl = ana.DirDataLayer(pickle_dir="/tmp/test_ana")
|
||||
one = A(1)
|
||||
nose.tools.assert_is(one, A.ana_load(one.ana_store()))
|
||||
nose.tools.assert_true(os.path.exists("/tmp/test_ana/%s.p" % one.ana_uuid))
|
||||
self.assertIs(one, A.ana_load(one.ana_store()))
|
||||
self.assertTrue(os.path.exists("/tmp/test_ana/%s.p" % one.ana_uuid))
|
||||
|
||||
uuid = one.ana_uuid
|
||||
old_id = id(one)
|
||||
@ -110,8 +109,7 @@ def test_dir():
|
||||
gc.collect()
|
||||
ana.dl = ana.DirDataLayer(pickle_dir="/tmp/test_ana")
|
||||
two = A.ana_load(uuid)
|
||||
nose.tools.assert_equals(uuid, two.ana_uuid)
|
||||
nose.tools.assert_not_equals(old_id, id(two))
|
||||
self.assertEquals(uuid, two.ana_uuid)
|
||||
|
||||
# reset the datalayer to make sure we handle it properly
|
||||
ana.set_dl(ana.DictDataLayer())
|
||||
@ -125,17 +123,6 @@ def test_dir():
|
||||
three = A.ana_load(uuid)
|
||||
assert uuid, three.ana_uuid
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
logging.getLogger("ana.test").setLevel(logging.DEBUG)
|
||||
logging.getLogger("ana.storable").setLevel(logging.DEBUG)
|
||||
logging.getLogger("ana.datalayer").setLevel(logging.DEBUG)
|
||||
logging.getLogger("ana.d").setLevel(logging.DEBUG)
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
globals()['test_%s' % sys.argv[1]]()
|
||||
else:
|
||||
test_simple()
|
||||
test_dict()
|
||||
test_dir()
|
||||
|
||||
unittest.main()
|
||||
|
@ -1,233 +0,0 @@
|
||||
--- test.py.orig 2020-03-25 14:52:11.172556627 +0100
|
||||
+++ test.py 2020-03-25 14:41:33.347473176 +0100
|
||||
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
import gc
|
||||
import ana
|
||||
-import nose
|
||||
+import unittest
|
||||
import pickle
|
||||
|
||||
import logging
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
class A(ana.Storable):
|
||||
def __init__(self, n):
|
||||
- nose.tools.assert_false(hasattr(self, 'n'))
|
||||
-
|
||||
self.n = n
|
||||
l.debug("%s.__init__", self)
|
||||
|
||||
@@ -28,114 +26,104 @@
|
||||
def _ana_getliteral(self):
|
||||
return { 'n': self.n }
|
||||
|
||||
-def test_simple():
|
||||
- ana.set_dl(ana.SimpleDataLayer())
|
||||
- one = A(1)
|
||||
- one.make_uuid()
|
||||
- o = pickle.dumps(one)
|
||||
- one_copy = pickle.loads(o)
|
||||
- assert one is one_copy
|
||||
-
|
||||
- two = A(1)
|
||||
- t = pickle.dumps(one)
|
||||
- two_copy = pickle.loads(t)
|
||||
- assert two_copy is not two
|
||||
-
|
||||
- assert pickle.load(open(os.path.join(os.path.dirname(__file__), 'test_pickle.p'), 'rb')).n == 1337
|
||||
-
|
||||
-def write_a1337():
|
||||
- a1337 = A(1337)
|
||||
- a1337.make_uuid()
|
||||
- pickle.dump(a1337, open(os.path.join(os.path.dirname(__file__), 'test_pickle.p'), 'w'))
|
||||
-
|
||||
-def test_dict():
|
||||
- ana.set_dl(ana.DictDataLayer())
|
||||
- l.debug("Initializing 1")
|
||||
- one = A(1)
|
||||
- l.debug("Initializing 2")
|
||||
- two = A(2)
|
||||
-
|
||||
- one.make_uuid()
|
||||
-
|
||||
- l.debug("Copying 1")
|
||||
- one_p = pickle.dumps(one)
|
||||
- one_copy = pickle.loads(one_p)
|
||||
- l.debug("Copying 2")
|
||||
- two_p = pickle.dumps(two)
|
||||
- two_copy = pickle.loads(two_p)
|
||||
-
|
||||
- nose.tools.assert_is(one_copy, one)
|
||||
- nose.tools.assert_is_not(two_copy, two)
|
||||
- nose.tools.assert_equal(str(two_copy), str(two))
|
||||
-
|
||||
- nose.tools.assert_is(one, A.ana_load(one.ana_store()))
|
||||
- nose.tools.assert_is(two, A.ana_load(two.ana_store()))
|
||||
-
|
||||
- two_copy2 = pickle.loads(pickle.dumps(two))
|
||||
- nose.tools.assert_equal(str(two_copy2), str(two))
|
||||
-
|
||||
- l.debug("Initializing 3")
|
||||
- three = A(3)
|
||||
- three_str = str(three)
|
||||
- l.debug("Storing 3")
|
||||
- three_uuid = three.ana_store()
|
||||
- l.debug("Deleting 3")
|
||||
- del three
|
||||
- gc.collect()
|
||||
- nose.tools.assert_false(three_uuid in ana.get_dl().uuid_cache)
|
||||
- l.debug("Loading 3")
|
||||
- three_copy = A.ana_load(three_uuid)
|
||||
- nose.tools.assert_equal(three_copy.ana_uuid, three_uuid) #pylint:disable=no-member
|
||||
- nose.tools.assert_equal(str(three_copy), three_str)
|
||||
-
|
||||
- known = set()
|
||||
- first_json = three_copy.to_literal(known)
|
||||
- nose.tools.assert_true(three_copy.ana_uuid in first_json['objects'])
|
||||
- nose.tools.assert_equal(first_json['objects'][three_copy.ana_uuid]['object']['n'], three_copy.n)
|
||||
- nose.tools.assert_equal(first_json['value']['ana_uuid'], three_copy.ana_uuid)
|
||||
-
|
||||
- second_json = three_copy.to_literal(known)
|
||||
- nose.tools.assert_false(three_copy.ana_uuid in second_json['objects'])
|
||||
- nose.tools.assert_equal(second_json['value']['ana_uuid'], three_copy.ana_uuid)
|
||||
-
|
||||
-def test_dir():
|
||||
- ana.dl = ana.DirDataLayer(pickle_dir="/tmp/test_ana")
|
||||
- one = A(1)
|
||||
- nose.tools.assert_is(one, A.ana_load(one.ana_store()))
|
||||
- nose.tools.assert_true(os.path.exists("/tmp/test_ana/%s.p" % one.ana_uuid))
|
||||
-
|
||||
- uuid = one.ana_uuid
|
||||
- old_id = id(one)
|
||||
- del one
|
||||
- gc.collect()
|
||||
- ana.dl = ana.DirDataLayer(pickle_dir="/tmp/test_ana")
|
||||
- two = A.ana_load(uuid)
|
||||
- nose.tools.assert_equals(uuid, two.ana_uuid)
|
||||
- nose.tools.assert_not_equals(old_id, id(two))
|
||||
-
|
||||
- # reset the datalayer to make sure we handle it properly
|
||||
- ana.set_dl(ana.DictDataLayer())
|
||||
- try:
|
||||
+class TestAna(unittest.TestCase):
|
||||
+ def test_simple(self):
|
||||
+ ana.set_dl(ana.SimpleDataLayer())
|
||||
+ one = A(1)
|
||||
+ one.make_uuid()
|
||||
+ o = pickle.dumps(one)
|
||||
+ one_copy = pickle.loads(o)
|
||||
+ assert one is one_copy
|
||||
+
|
||||
+ two = A(1)
|
||||
+ t = pickle.dumps(one)
|
||||
+ two_copy = pickle.loads(t)
|
||||
+ assert two_copy is not two
|
||||
+
|
||||
+ assert pickle.load(open(os.path.join(os.path.dirname(__file__), 'test_pickle.p'), 'rb')).n == 1337
|
||||
+
|
||||
+ def write_a1337(self):
|
||||
+ a1337 = A(1337)
|
||||
+ a1337.make_uuid()
|
||||
+ pickle.dump(a1337, open(os.path.join(os.path.dirname(__file__), 'test_pickle.p'), 'w'))
|
||||
+
|
||||
+ def test_dict(self):
|
||||
+ ana.set_dl(ana.DictDataLayer())
|
||||
+ l.debug("Initializing 1")
|
||||
+ one = A(1)
|
||||
+ l.debug("Initializing 2")
|
||||
+ two = A(2)
|
||||
+
|
||||
+ one.make_uuid()
|
||||
+
|
||||
+ l.debug("Copying 1")
|
||||
+ one_p = pickle.dumps(one)
|
||||
+ one_copy = pickle.loads(one_p)
|
||||
+ l.debug("Copying 2")
|
||||
+ two_p = pickle.dumps(two)
|
||||
+ two_copy = pickle.loads(two_p)
|
||||
+
|
||||
+ self.assertIs(one_copy, one)
|
||||
+ self.assertIsNot(two_copy, two)
|
||||
+ self.assertEqual(str(two_copy), str(two))
|
||||
+
|
||||
+ self.assertIs(one, A.ana_load(one.ana_store()))
|
||||
+ self.assertIs(two, A.ana_load(two.ana_store()))
|
||||
+
|
||||
+ two_copy2 = pickle.loads(pickle.dumps(two))
|
||||
+ self.assertEqual(str(two_copy2), str(two))
|
||||
+
|
||||
+ l.debug("Initializing 3")
|
||||
+ three = A(3)
|
||||
+ three_str = str(three)
|
||||
+ l.debug("Storing 3")
|
||||
+ three_uuid = three.ana_store()
|
||||
+ l.debug("Deleting 3")
|
||||
+ del three
|
||||
+ gc.collect()
|
||||
+ self.assertFalse(three_uuid in ana.get_dl().uuid_cache)
|
||||
+ l.debug("Loading 3")
|
||||
+ three_copy = A.ana_load(three_uuid)
|
||||
+ self.assertEqual(three_copy.ana_uuid, three_uuid) #pylint:disable=no-member
|
||||
+ self.assertEqual(str(three_copy), three_str)
|
||||
+
|
||||
+ known = set()
|
||||
+ first_json = three_copy.to_literal(known)
|
||||
+ self.assertTrue(three_copy.ana_uuid in first_json['objects'])
|
||||
+ self.assertEqual(first_json['objects'][three_copy.ana_uuid]['object']['n'], three_copy.n)
|
||||
+ self.assertEqual(first_json['value']['ana_uuid'], three_copy.ana_uuid)
|
||||
+
|
||||
+ second_json = three_copy.to_literal(known)
|
||||
+ self.assertFalse(three_copy.ana_uuid in second_json['objects'])
|
||||
+ self.assertEqual(second_json['value']['ana_uuid'], three_copy.ana_uuid)
|
||||
+
|
||||
+ def test_dir(self):
|
||||
+ ana.dl = ana.DirDataLayer(pickle_dir="/tmp/test_ana")
|
||||
+ one = A(1)
|
||||
+ self.assertIs(one, A.ana_load(one.ana_store()))
|
||||
+ self.assertTrue(os.path.exists("/tmp/test_ana/%s.p" % one.ana_uuid))
|
||||
+
|
||||
+ uuid = one.ana_uuid
|
||||
+ old_id = id(one)
|
||||
+ del one
|
||||
+ gc.collect()
|
||||
+ ana.dl = ana.DirDataLayer(pickle_dir="/tmp/test_ana")
|
||||
two = A.ana_load(uuid)
|
||||
- assert False
|
||||
- except KeyError:
|
||||
- pass
|
||||
- two.ana_store()
|
||||
- del two
|
||||
- three = A.ana_load(uuid)
|
||||
- assert uuid, three.ana_uuid
|
||||
+ self.assertEquals(uuid, two.ana_uuid)
|
||||
+ self.assertNotEqual(old_id, id(two))
|
||||
|
||||
-if __name__ == '__main__':
|
||||
- import sys
|
||||
- logging.getLogger("ana.test").setLevel(logging.DEBUG)
|
||||
- logging.getLogger("ana.storable").setLevel(logging.DEBUG)
|
||||
- logging.getLogger("ana.datalayer").setLevel(logging.DEBUG)
|
||||
- logging.getLogger("ana.d").setLevel(logging.DEBUG)
|
||||
-
|
||||
- if len(sys.argv) > 1:
|
||||
- globals()['test_%s' % sys.argv[1]]()
|
||||
- else:
|
||||
- test_simple()
|
||||
- test_dict()
|
||||
- test_dir()
|
||||
+ # reset the datalayer to make sure we handle it properly
|
||||
+ ana.set_dl(ana.DictDataLayer())
|
||||
+ try:
|
||||
+ two = A.ana_load(uuid)
|
||||
+ assert False
|
||||
+ except KeyError:
|
||||
+ pass
|
||||
+ two.ana_store()
|
||||
+ del two
|
||||
+ three = A.ana_load(uuid)
|
||||
+ assert uuid, three.ana_uuid
|
||||
|
||||
+
|
||||
+if __name__ == '__main__':
|
||||
+ unittest.main()
|
Loading…
Reference in New Issue
Block a user