irmen / Pyro4

Pyro 4.x - Python remote objects
http://pyro4.readthedocs.io/
MIT License
713 stars 83 forks source link

also raise on exposed Python 3.10 cmethod/smethod #238

Closed bnavigator closed 2 years ago

bnavigator commented 2 years ago

New version of #237.

test_util.py::TestMetaAndExpose::testClassmethodExposeWrongOrderFail fails on Python 3.10, because there was a change in the API:

def mydeco(method_or_class):
   attrname = getattr(method_or_class, "__name__", None)
   print(attrname, isinstance(method_or_class, (staticmethod, classmethod)))
   return method_or_class

class TestClass:
  @mydeco
  @classmethod
  def cmethod_F(cls):
     pass

  @mydeco
  @staticmethod
  def smethod_F(cls):
     pass

  @classmethod
  @mydeco
  def cmethod_OK(cls):
     pass

  @staticmethod
  @mydeco
  def smethod_OK(cls):
     pass
abuild@skylab:~/rpmbuild/BUILD/Pyro4-4.81> python2 mytest.py
(None, True)
(None, True)
('cmethod_OK', False)
('smethod_OK', False)
abuild@skylab:~/rpmbuild/BUILD/Pyro4-4.81> python3.8 mytest.py 
None True
None True
cmethod_OK False
smethod_OK False
abuild@skylab:~/rpmbuild/BUILD/Pyro4-4.81> python3.10 mytest.py 
cmethod_F True
smethod_F True
cmethod_OK False
smethod_OK False
abuild@skylab:~/rpmbuild/BUILD/Pyro4-4.81>
irmen commented 2 years ago

not really sure what the problem is, the 3.10 ci build succeeds: https://github.com/irmen/Pyro4/runs/4622181116?check_suite_focus=true

It could be that a proper unit test is lacking for your scenario

bnavigator commented 2 years ago

Your CI is not set up properly. You are running all the jobs with the system default of Python 3.8.

bnavigator commented 2 years ago

test_util.py::TestMetaAndExpose::testClassmethodExposeWrongOrderFail is the proper unit test:

abuild@skylab:~/rpmbuild/BUILD/Pyro4-4.81/tests> python3.10 run_testsuite.py 
chdir to /home/abuild/rpmbuild/BUILD/Pyro4-4.81/tests
gathering testcases from ['test_core', 'test_daemon', 'test_echoserver', 'test_flame', 'test_httpgateway', 'test_ironpython', 'test_message', 'test_naming', 'test_naming2', 'test_package', 'test_serialize', 'test_server', 'test_server_timeout', 'test_socket', 'test_threadpool', 'test_util', 'testsupport']

RUNNING UNIT TESTS...
............................................/home/abuild/rpmbuild/BUILDROOT/python-Pyro4-4.81-0.x86_64/usr/lib/python3.10/site-packages/Pyro4/core.py:901: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  thread.setDaemon(True)
/home/abuild/rpmbuild/BUILDROOT/python-Pyro4-4.81-0.x86_64/usr/lib/python3.10/site-packages/Pyro4/futures.py:185: DeprecationWarning: isSet() is deprecated, use is_set() instead
  if self.__ready.isSet():
./home/abuild/rpmbuild/BUILDROOT/python-Pyro4-4.81-0.x86_64/usr/lib/python3.10/site-packages/Pyro4/futures.py:147: DeprecationWarning: isSet() is deprecated, use is_set() instead
  return self.__ready.isSet()
........../home/abuild/rpmbuild/BUILDROOT/python-Pyro4-4.81-0.x86_64/usr/lib/python3.10/site-packages/Pyro4/futures.py:51: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  thread.setDaemon(True)
.............../home/abuild/rpmbuild/BUILD/Pyro4-4.81/tests/PyroTests/test_daemon.py:134: ResourceWarning: unclosed <socket.socket fd=13, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
  s1, s2 = socket.socketpair()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/usr/lib64/python3.10/unittest/case.py:549: ResourceWarning: unclosed <socket.socket fd=14, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
  method()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
.................../home/abuild/rpmbuild/BUILDROOT/python-Pyro4-4.81-0.x86_64/usr/lib/python3.10/site-packages/Pyro4/core.py:1234: DeprecationWarning: isSet() is deprecated, use is_set() instead
  condition = lambda: not self.__mustshutdown.isSet() and loopCondition()
.........../home/abuild/rpmbuild/BUILD/Pyro4-4.81/tests/PyroTests/test_echoserver.py:18: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  self.setDaemon(True)
..................................../home/abuild/rpmbuild/BUILDROOT/python-Pyro4-4.81-0.x86_64/usr/lib/python3.10/site-packages/Pyro4/naming.py:421: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  thread.setDaemon(True)
/home/abuild/rpmbuild/BUILD/Pyro4-4.81/tests/PyroTests/test_naming.py:21: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  self.setDaemon(True)
...............................sssssssssssssssssssssssssssssssssss....................ss............................s........ss............................s.......................................sss.s.....s.....s.................s.......s............................s........ss................................................................../home/abuild/rpmbuild/BUILD/Pyro4-4.81/tests/PyroTests/test_server.py:126: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  self.setDaemon(True)
............../home/abuild/rpmbuild/BUILD/Pyro4-4.81/tests/PyroTests/test_server.py:1084: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  self.setDaemon(True)
............/home/abuild/rpmbuild/BUILD/Pyro4-4.81/tests/PyroTests/test_server.py:696: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  self.setDaemon(True)
......................................../home/abuild/rpmbuild/BUILD/Pyro4-4.81/tests/PyroTests/test_server.py:1041: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  self.setDaemon(True)
......./home/abuild/rpmbuild/BUILD/Pyro4-4.81/tests/PyroTests/test_server.py:126: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  self.setDaemon(True)
..........................................s..s..s.s..s../home/abuild/rpmbuild/BUILD/Pyro4-4.81/tests/PyroTests/test_socket.py:326: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
  serverthread.setDaemon(True)
....s........F......................
======================================================================
FAIL: testClassmethodExposeWrongOrderFail (PyroTests.test_util.TestMetaAndExpose)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/abuild/rpmbuild/BUILD/Pyro4-4.81/tests/PyroTests/test_util.py", line 375, in testClassmethodExposeWrongOrderFail
    with self.assertRaises(AttributeError) as ax:
AssertionError: AttributeError not raised

----------------------------------------------------------------------
Ran 644 tests in 81.052s
bnavigator commented 2 years ago

It's part of #240 now.