For this error message, in autotest/client/shared/utils.py, we need to replace `chars = string.letters + string.digits + string.punctuation` with `chars = string.ascii_letters + string.digits + string.punctuation`.
After solving this, we'll also have issues with autotest/client/shared/aexpect.py: 1) We need to replace `sub.stdin.write("%s\n" % <value>) with something like `sub.stdin.write("{}\n".format(<value>).encode('utf-8'))` OR `sub.communicate(input="{}\n".format(<value>).encode("utf-8"))` to solve the following error: ``` File "/home/ubuntu/autotest/client/shared/aexpect.py", line 569, in __init__ sub.stdin.write("%s\n" % self.a_id) TypeError: a bytes-like object is required, not 'str' ``` 2) We'll have to replace the bits where we wait for the subprocess to finish with something similar (or equal) to `https://github.com/avocado-framework/aexpect/blob/9febbe9466f8f96a5c34a9f5e51c5334b8b24966/aexpect/client.py#L251` to solve this error: ``` File "/home/ubuntu/autotest/client/shared/aexpect.py", line 574, in __init__ while "Server %s ready" % self.a_id not in sub.stdout.readline(): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: a bytes-like object is required, not 'str' ``` 3) We get this error: ``` File "/home/ubuntu/autotest/client/shared/aexpect.py", line 14, in <module> import tempfile File "/usr/lib/python3.12/tempfile.py", line 44, in <module> import shutil as _shutil File "/usr/lib/python3.12/shutil.py", line 10, in <module> import fnmatch File "/usr/lib/python3.12/fnmatch.py", line 14, in <module> import re File "/usr/lib/python3.12/re/__init__.py", line 141, in <module> @enum.global_enum ^^^^^^^^^^^^^^^^ AttributeError: module \'enum\' has no attribute \'global_enum\' ``` It seems that `re` is somehow importing `enum` from `autotest/client/shared/enum.py` instead of import it from `/usr/lib/python3.12/enum.py`. I haven't solved this. There could be other errors after solving 3) above. I was wondering if/how we could just use https://github.com/avocado-framework/aexpect/ instead, which seems more modern. -- You received this bug notification because you are a member of Canonical Platform QA Team, which is subscribed to ubuntu-kernel-tests. https://bugs.launchpad.net/bugs/2089633 Title: fips_test failed with "AttributeError: module 'string' has no attribute 'letters'" on Noble Status in ubuntu-kernel-tests: New Bug description: This is a followup of bug 2068609. After fixing the platform module issue in there, test results revealed some other stuff that we need to fix, the test is now failing with: Traceback (most recent call last): File "/home/ubuntu/autotest/client/shared/test.py", line 823, in _call_test_function return func(*args, **dargs) ^^^^^^^^^^^^^^^^^^^^ File "/home/ubuntu/autotest/client/shared/test.py", line 290, in execute self._call_run_once(constraints, profile_only, File "/home/ubuntu/autotest/client/shared/test.py", line 212, in _call_run_once self.run_once(*args, **dargs) File "/home/ubuntu/autotest/client/tests/fips_test/fips_test.py", line 57, in run_once self.do_test() File "/home/ubuntu/autotest/client/tests/fips_test/fips_test.py", line 114, in do_test self.console = run_tail('virsh console "%s"' % self.remote_name, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ubuntu/autotest/client/shared/aexpect.py", line 390, in run_tail process = Tail(command=command, ^^^^^^^^^^^^^^^^^^^^^ File "/home/ubuntu/autotest/client/shared/aexpect.py", line 866, in __init__ Spawn.__init__(self, command, a_id, auto_close, echo, linesep) File "/home/ubuntu/autotest/client/shared/aexpect.py", line 518, in __init__ self.a_id = a_id or utils.generate_random_string(8) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ubuntu/autotest/client/shared/utils.py", line 2278, in generate_random_string chars = string.letters + string.digits + string.punctuation ^^^^^^^^^^^^^^ AttributeError: module 'string' has no attribute 'letters' We need some compatibility fix in autotest. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/2089633/+subscriptions -- Mailing list: https://launchpad.net/~canonical-ubuntu-qa Post to : canonical-ubuntu-qa@lists.launchpad.net Unsubscribe : https://launchpad.net/~canonical-ubuntu-qa More help : https://help.launchpad.net/ListHelp