Open kloczek opened 1 year ago
I pushed a commit that should resolve this failure. However, I don't have a windows machine currently configured for development. Let me know if that does the trick! Thanks!
Just tested 6.0.0 and looks like now pytest fails because test suite cannot find support
and cfg_tests
modules
Below quick patch fixed scanning
--- 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
+import tests.cfg_tests
try:
import pandas as pd
import numpy as np
--- a/tests/test_affinity.py
+++ b/tests/test_affinity.py
@@ -1,7 +1,7 @@
import sys
import time
import unittest
-import support
+import tests.support
import rpyc
But pytest started failing in more units
Looks like more fixes around imports are needed.
Here is improved version of above patch.
--- 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
--- 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
--- a/tests/test_attributes.py
+++ b/tests/test_attributes.py
@@ -26,7 +26,7 @@
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
--- a/tests/test_classic.py
+++ b/tests/test_classic.py
@@ -52,7 +52,7 @@
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)
--- a/tests/test_magic.py
+++ b/tests/test_magic.py
@@ -37,7 +37,7 @@
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_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)
--- a/tests/test_netref_hierachy.py
+++ b/tests/test_netref_hierachy.py
@@ -108,15 +108,15 @@
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))
With above pytest still fails with:
After send prod build request to my build infra I found that units which requires running ssh server on local hosts are failing
I think that it would be better if test suite in session will start sshd on some high port and use it to test module remote calls.
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulescut off from access to the public network
(pytest is executed with-m "not network"
)Here is pytest output:
Here is list of installed modules in build env