Closed mtelka closed 1 year ago
The problem seems to be that c_ext
is set to True
in test/test_frozendict_c.py
, so particular tests are not skipped later in test/common.py
:
if c_ext or (
pyversion_major > 3 or
(pyversion_major == 3 and pyversion_minor > 7)
):
def test_reversed_keys(fd, fd_dict):
assert(tuple(reversed(fd.keys())) == tuple(reversed(tuple(fd_dict.keys()))))
def test_reversed_items(fd, fd_dict):
assert(tuple(reversed(fd.items())) == tuple(reversed(tuple(fd_dict.items()))))
def test_reversed_values(fd, fd_dict):
assert(tuple(reversed(fd.values())) == tuple(reversed(tuple(fd_dict.values()))))
Can you post the result of this command?
print(reversed(({1:2}).keys()))
$ python3.7 -c 'print(reversed(({1:2}).keys()))'
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: 'dict_keys' object is not reversible
$ python3.9 -c 'print(reversed(({1:2}).keys()))'
<dict_reversekeyiterator object at 0x7fffaf1746d0>
$
Are you sure you're using the C Extension? I can reproduce these errors with the pure py version.
Have you downloaded the sources from Github?
Are you sure you're using the C Extension? I can reproduce these errors with the pure py version.
No. How can I check that? I think it is not there because test_c_extension
fails too - see #73.
Have you downloaded the sources from Github?
frozendict tarball was downloaded from PyPI.
It was built using /usr/bin/python3.7 setup.py --no-user-cfg build
, then installed using /usr/bin/python3.7 setup.py --no-user-cfg install --root $(PROTO_DIR) --install-lib=/usr/lib/python3.7/vendor-packages --install-data=/usr/lib/python3.7/vendor-packages --skip-build --force
and then tested using /usr/bin/python3.7 -m pytest --color=no --verbose
, and finally packaged for OpenIndiana with failing tests disabled.
Please try:
cd test
/usr/bin/python3.7 -m pytest
PS: never install a package in the global environment. Use always a venv. PPS: how have you installed Python 3.7 on your machine?
Please try:
cd test /usr/bin/python3.7 -m pytest
All 455 tests passed.
I tried the same without descending to test
subdir and 13 tests failed:
FAILED test/test_frozendict_c_subclass.py::test_reversed_keys - TypeError: 'dict_keys' object is not reversible
FAILED test/test_frozendict_c_subclass.py::test_mapping_items - AttributeError: 'dict_items' object has no attribute 'mapping'
FAILED test/test_frozendict_c_subclass.py::test_reversed_items - TypeError: 'dict_items' object is not reversible
FAILED test/test_frozendict_c_subclass.py::test_mapping_values - AttributeError: 'dict_values' object has no attribute 'mapping'
FAILED test/test_frozendict_c_subclass.py::test_reversed_values - TypeError: 'dict_values' object is not reversible
FAILED test/test_frozendict_c_subclass.py::test_mapping_keys - AttributeError: 'dict_keys' object has no attribute 'mapping'
FAILED test/test_frozendict_c.py::test_mapping_items - AttributeError: 'dict_items' object has no attribute 'mapping'
FAILED test/test_frozendict_c.py::test_reversed_values - TypeError: 'dict_values' object is not reversible
FAILED test/test_frozendict_c.py::test_reversed_items - TypeError: 'dict_items' object is not reversible
FAILED test/test_frozendict_c.py::test_mapping_values - AttributeError: 'dict_values' object has no attribute 'mapping'
FAILED test/test_frozendict_c.py::test_c_extension - AssertionError
FAILED test/test_frozendict_c.py::test_mapping_keys - AttributeError: 'dict_keys' object has no attribute 'mapping'
FAILED test/test_frozendict_c.py::test_reversed_keys - TypeError: 'dict_keys' object is not reversible
PS: never install a package in the global environment. Use always a venv.
Sorry, I'm packaging frozendict for operating system, so I need to test in the real environment.
PPS: how have you installed Python 3.7 on your machine?
pkg install python-37
All 455 tests passed.
That's normal. In the project main dir, the source directory is frozendict
. So python by default import the source code in the current dir, that does not contain the compiled extension.
Maybe I should rename the folder frozendict
to src
. The problem is the folder with the CPython code is named src
. Maybe I could name it c_src
.
Sorry, I'm packaging frozendict for operating system, so I need to test in the real environment.
venv is not fakeroot or docker:
The venv module supports creating lightweight “virtual environments”, each with their own independent set of Python packages installed in their site directories. A virtual environment is created on top of an existing Python installation, known as the virtual environment’s “base” Python, and may optionally be isolated from the packages in the base environment, so only those explicitly installed in the virtual environment are available.
https://docs.python.org/3/library/venv.html
PPS: how have you installed Python 3.7 on your machine?
pkg install python-37
Okay..... so why you need all that options for setup.py
?
All 455 tests passed.
That's normal. In the project main dir, the source directory is
frozendict
. So python by default import the source code in the current dir, that does not contain the compiled extension.Maybe I should rename the folder
frozendict
tosrc
. The problem is the folder with the CPython code is namedsrc
. Maybe I could name itc_src
.
Ah, indeed. This is well known problem. The only universal solution I'm aware of is -P option, but it is available in Python 3.11 and newer only.
Thank you very much for your time and for help with diagnosing this. I'll run pytest in the test
subdirectory until either all Pythons < 3.11 are obsoleted (so I can use -P everywhere), or you remove (rename) the frozendict
directory.
Opened #75
PS: notice that you should also run test/debug.py
to have a full test coverage, or simply run mytest.sh
Package structure changed in 2.3.6
Welcome! You should write in your Bug Report:
OS version (https://www.google.com/search?channel=fs&q=check+os+version&ie=utf-8&oe=utf-8): OpenIndiana
Python3 version (python3 -V -V):
Python 3.7.16
Steps to reproduce:
Actual result (with the python stack trace if present):
In addition to seven tests that are failing for Python 3.9.16 too, there are six more tests that are failing for Python 3.7.16:
Failure details: