Skip to content

Commit

Permalink
Make sure test case verifies returned rather than cached object
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenisanerd committed Feb 28, 2013
1 parent 17bba02 commit 94ffc08
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 1 addition & 2 deletions riakalchemy/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ def connect(host='127.0.0.1', port=8098, test_server=False):
if test_server:
global _test_server
if _test_server:
_test_server.cleanup()
_test_server.stop()
return
from riak.test_server import TestServer, Atom
import tempfile
tmpdir = tempfile.mkdtemp()
Expand Down
12 changes: 8 additions & 4 deletions riakalchemy/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_save_and_retrieve_object(self):
cls, obj = self._set_values_on_init(values)
obj.save()
self.addCleanup(obj.delete)
cls.get(obj.key)
obj = cls.get(obj.key)
self._verify_values(obj, values)

def test_save_delete_retrieve_failes(self):
Expand Down Expand Up @@ -262,8 +262,12 @@ class RiakBackedTests(_BasicTests):
test_server_started = False

def setUp(self):
if not use_system_riak and not self.__class__.test_server_started:
riakalchemy.connect(test_server=True, port=riak_port)
self.__class__.test_server_started = True
if not use_system_riak:
if not self.__class__.test_server_started:
riakalchemy.connect(test_server=True, port=riak_port)
riakalchemy.model._clear_test_connection()
self.__class__.test_server_started = True
else:
riakalchemy.model._clear_test_connection()
else:
riakalchemy.connect(test_server=False, port=riak_port)

0 comments on commit 94ffc08

Please sign in to comment.