Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

2.0.0: pytest is failing #1114

Closed
kloczek opened this issue Aug 28, 2021 · 3 comments · Fixed by #1213
Closed

2.0.0: pytest is failing #1114

kloczek opened this issue Aug 28, 2021 · 3 comments · Fixed by #1213
Labels
need investigation Need to look into described issue.

Comments

@kloczek
Copy link

kloczek commented Aug 28, 2021

I'm trying to package your module as an rpm package. So I'm using the typical build, install and test cycle used on building packages from non-root account.

  • "setup.py build"
  • "setup.py install --root </install/prefix>"
  • "pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

May I ask for help? One unit is failing.

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-aioredis-2.0.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-aioredis-2.0.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
934942:C 28 Aug 2021 13:45:54.042 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
934942:C 28 Aug 2021 13:45:54.042 # Redis version=6.2.2, bits=64, commit=00000000, modified=0, pid=934942, just started
934942:C 28 Aug 2021 13:45:54.042 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
934942:M 28 Aug 2021 13:45:54.043 * Increased maximum number of open files to 10032 (it was originally set to 1024).
934942:M 28 Aug 2021 13:45:54.043 * monotonic clock: POSIX clock_gettime
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 6.2.2 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 934942
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           https://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

934942:M 28 Aug 2021 13:45:54.044 # Server initialized
934942:M 28 Aug 2021 13:45:54.044 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
934942:M 28 Aug 2021 13:45:54.045 * Ready to accept connections
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=23350148
rootdir: /home/tkloczko/rpmbuild/BUILD/aioredis-py-2.0.0
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, anyio-3.3.0, asyncio-0.15.1, trio-0.7.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0, randomly-3.8.0, Faker-8.12.1, nose2pytest-1.0.8
collected 894 items

tests/test_scripting.py ..............                                                                                                                               [  1%]
tests/test_sentinel.py ............                                                                                                                                  [  2%]
tests/test_monitor.py ............                                                                                                                                   [  4%]
tests/test_encoding.py .934942:M 28 Aug 2021 13:45:58.975 * DB saved on disk
.934942:M 28 Aug 2021 13:45:58.983 * DB saved on disk
.934942:M 28 Aug 2021 13:45:58.990 * DB saved on disk
.934942:M 28 Aug 2021 13:45:58.996 * DB saved on disk
.934942:M 28 Aug 2021 13:45:59.003 * DB saved on disk
.934942:M 28 Aug 2021 13:45:59.011 * DB saved on disk
.934942:M 28 Aug 2021 13:45:59.017 * DB saved on disk
.934942:M 28 Aug 2021 13:45:59.025 * DB saved on disk
.934942:M 28 Aug 2021 13:45:59.033 * DB saved on disk
.934942:M 28 Aug 2021 13:45:59.047 * DB saved on disk
.934942:M 28 Aug 2021 13:45:59.058 * DB saved on disk
.934942:M 28 Aug 2021 13:45:59.068 * DB saved on disk
............                                                                                                                      [  6%]
tests/test_pipeline.py ..................................................                                                                                            [ 12%]
tests/test_commands.py ............................................................................................................................................. [ 28%]
.........................................s.......................................................................................................................... [ 46%]
....................................................................................................................s............................................... [ 64%]
...............................................................................................                                                                      [ 75%]
tests/test_connection_pool.py ...........934942:M 28 Aug 2021 13:46:14.246 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.253 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.262 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.402 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.424 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.660 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.693 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.726 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.741 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.752 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.763 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.777 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.790 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.802 * DB saved on disk
.934942:M 28 Aug 2021 13:46:14.813 * DB saved on disk
.934942:M 28 Aug 2021 13:46:15.049 * DB saved on disk
.934942:M 28 Aug 2021 13:46:15.068 * DB saved on disk
.934942:M 28 Aug 2021 13:46:15.212 * DB saved on disk
.934942:M 28 Aug 2021 13:46:15.231 * DB saved on disk
.934942:M 28 Aug 2021 13:46:15.243 * DB saved on disk
..................................................                                                       [ 84%]
tests/test_multiprocessing.py x934942:M 28 Aug 2021 13:46:15.790 * DB saved on disk
x934942:M 28 Aug 2021 13:46:15.828 * DB saved on disk
xxxxxxxx                                                                                                                             [ 85%]
tests/test_connection.py F...                                                                                                                                        [ 86%]
tests/test_pubsub.py ........................................................................                                                                        [ 94%]
tests/test_lock.py .....934942:M 28 Aug 2021 13:46:23.263 * DB saved on disk
......................934942:M 28 Aug 2021 13:46:23.571 * DB saved on disk
.........................                                                                                              [100%]

================================================================================= FAILURES =================================================================================
_______________________________________________________________________ test_invalid_response[pool] ________________________________________________________________________

r = Redis<ConnectionPool<Connection<host=localhost,port=6379,db=9>>>

    @pytest.mark.skipif(HIREDIS_AVAILABLE, reason="PythonParser only")
    @pytest.mark.asyncio
    async def test_invalid_response(r):
        raw = b"x"
>       parser: "PythonParser" = r.connection._parser
E       AttributeError: 'NoneType' object has no attribute '_parser'

tests/test_connection.py:18: AttributeError
========================================================================= short test summary info ==========================================================================
SKIPPED [2] tests/test_commands.py:2182: Redis version required < 4.0.0
XFAIL tests/test_multiprocessing.py::TestMultiprocessing::test_aioredis_client[pool]
XFAIL tests/test_multiprocessing.py::TestMultiprocessing::test_aioredis_client[single]
XFAIL tests/test_multiprocessing.py::TestMultiprocessing::test_close_pool_in_main[2]
XFAIL tests/test_multiprocessing.py::TestMultiprocessing::test_close_pool_in_main[1]
XFAIL tests/test_multiprocessing.py::TestMultiprocessing::test_close_pool_in_main[None]
XFAIL tests/test_multiprocessing.py::TestMultiprocessing::test_pool[2]
XFAIL tests/test_multiprocessing.py::TestMultiprocessing::test_close_connection_in_child
XFAIL tests/test_multiprocessing.py::TestMultiprocessing::test_pool[1]
XFAIL tests/test_multiprocessing.py::TestMultiprocessing::test_close_connection_in_parent
XFAIL tests/test_multiprocessing.py::TestMultiprocessing::test_pool[None]
FAILED tests/test_connection.py::test_invalid_response[pool] - AttributeError: 'NoneType' object has no attribute '_parser'
========================================================== 1 failed, 881 passed, 2 skipped, 10 xfailed in 27.03s ===========================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
@Andrew-Chen-Wang
Copy link
Collaborator

That's... strange. Can you ensure you see these lines in your package? https://github.com/aio-libs/aioredis-py/blob/10445b7bb03a789176bfd06bccc93494e7e54cdf/aioredis/connection.py#L515-L519

@Andrew-Chen-Wang Andrew-Chen-Wang added the need investigation Need to look into described issue. label Sep 17, 2021
@kloczek
Copy link
Author

kloczek commented Sep 17, 2021

Yes, I see that in tar ball https://github.com/aio-libs/aioredis-py/archive/v2.0.0/python-aioredis-2.0.0.tar.gz which I'm using in my rpm/Solaris IPS build procedure.

@Andrew-Chen-Wang
Copy link
Collaborator

Ok so somehow the connection is just missing? Can you check in the Redis cli that there is a connection even being made?

@Andrew-Chen-Wang Andrew-Chen-Wang linked a pull request Nov 22, 2021 that will close this issue
5 tasks
Andrew-Chen-Wang pushed a commit that referenced this issue Nov 22, 2021
* Fix buffer is closed error when using PythonParser class

Fixes #1212
Fixes #1114 

* Fix test_invalid_response on older python versions without AsyncMock
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need investigation Need to look into described issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants