From 5e4c31c9b45b841040f49fdb7b6670e1d68b9915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20K=C5=82oczko?= Date: Fri, 17 May 2024 14:07:14 +0000 Subject: [PATCH] fix pytest issies reported in #544 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomasz Kłoczko --- tests/test_affinity.py | 2 +- tests/test_attributes.py | 2 +- tests/test_classic.py | 2 +- tests/test_magic.py | 4 ++-- tests/test_netref_hierachy.py | 16 ++++++++-------- tests/test_service_pickle.py | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/test_affinity.py b/tests/test_affinity.py index 684070c9..44dccd54 100644 --- a/tests/test_affinity.py +++ b/tests/test_affinity.py @@ -1,7 +1,7 @@ import sys import time import unittest -import support +from tests import support import rpyc diff --git a/tests/test_attributes.py b/tests/test_attributes.py index 2d94af48..5b779bce 100644 --- a/tests/test_attributes.py +++ b/tests/test_attributes.py @@ -26,7 +26,7 @@ def tearDown(self): self.conn.close() def test_properties(self): - p = self.conn.modules["test_attributes"].Properties() + p = self.conn.modules["tests.test_attributes"].Properties() print(p.counter) # 1 print(p.counter) # 2 print(p.counter) # 3 diff --git a/tests/test_classic.py b/tests/test_classic.py index c0a4363e..b70b6b2e 100644 --- a/tests/test_classic.py +++ b/tests/test_classic.py @@ -52,7 +52,7 @@ def test_mock_connection(self): self.assertEqual(conn.eval("2+3"), 5) def test_modules(self): - self.assertIn('test_magic', self.conn.modules) + self.assertIn('tests.test_magic', self.conn.modules) self.assertNotIn('test_badmagic', self.conn.modules) self.assertIsNone(self.conn.builtins.locals()['self']._last_traceback) diff --git a/tests/test_magic.py b/tests/test_magic.py index 5f34d8db..319599e3 100644 --- a/tests/test_magic.py +++ b/tests/test_magic.py @@ -37,7 +37,7 @@ def tearDown(self): def test_hash_class(self): hesh = self.conn.builtins.hash - mod = self.conn.modules.test_magic + mod = self.conn.modules.tests.test_magic self.assertEqual(hash(mod.Base), 4321) self.assertEqual(hash(mod.Foo), 4321) self.assertEqual(hash(mod.Bar), 4321) @@ -53,7 +53,7 @@ def test_hash_class(self): def test_hash_obj(self): hesh = self.conn.builtins.hash - mod = self.conn.modules.test_magic + mod = self.conn.modules.tests.test_magic obj = mod.Base() self.assertNotEqual(hash(obj), 1234) diff --git a/tests/test_netref_hierachy.py b/tests/test_netref_hierachy.py index a038bfed..972de90c 100644 --- a/tests/test_netref_hierachy.py +++ b/tests/test_netref_hierachy.py @@ -108,15 +108,15 @@ def tearDown(self): def test_instancecheck_across_connections(self): self.conn2 = rpyc.classic.connect('localhost', port=18878) - self.conn.execute('import test_magic') - self.conn2.execute('import test_magic') - foo = self.conn.modules.test_magic.Foo() - bar = self.conn.modules.test_magic.Bar() - self.assertTrue(isinstance(foo, self.conn.modules.test_magic.Foo)) - self.assertTrue(isinstance(bar, self.conn2.modules.test_magic.Bar)) - self.assertFalse(isinstance(bar, self.conn.modules.test_magic.Foo)) + self.conn.execute('import tests.test_magic') + self.conn2.execute('import tests.test_magic') + foo = self.conn.modules.tests.test_magic.Foo() + bar = self.conn.modules.tests.test_magic.Bar() + self.assertTrue(isinstance(foo, self.conn.modules.tests.test_magic.Foo)) + self.assertTrue(isinstance(bar, self.conn2.modules.tests.test_magic.Bar)) + self.assertFalse(isinstance(bar, self.conn.modules.tests.test_magic.Foo)) with self.assertRaises(TypeError): - isinstance(self.conn.modules.test_magic.Foo, bar) + isinstance(self.conn.modules.tests.test_magic.Foo, bar) def test_classic(self): x = self.conn.builtin.list((1, 2, 3, 4)) diff --git a/tests/test_service_pickle.py b/tests/test_service_pickle.py index f2364d21..e9ecf0e3 100644 --- a/tests/test_service_pickle.py +++ b/tests/test_service_pickle.py @@ -4,7 +4,7 @@ import timeit import rpyc import unittest -import cfg_tests +from tests import cfg_tests try: import pandas as pd import numpy as np