Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests #108

Merged
merged 5 commits into from
Jan 17, 2022
Merged

Fix tests #108

merged 5 commits into from
Jan 17, 2022

Conversation

muhrin
Copy link
Collaborator

@muhrin muhrin commented Jan 12, 2022

Fixed tests by removing async_generator

This was being used for compatibility with py3.5 but we are not
supporting this anymore so we can rely on the build-in support for async
yields and test-asyncio for fixtures.

@chrisjsewell do you understand why the out jupyter notebook test fails? I don't understand the error message at all...

This was being used for compatibility with py3.5 but we are not
supporting this anymore so we can rely on the build-in support for async
yields and test-asyncio for fixtures.
@sphuber
Copy link
Collaborator

sphuber commented Jan 14, 2022

I thought this may have to do with the fact that a kernel is not installed. By installing one with pip install ipykernel the error is fixed, but another one appears:

        with open(my_dir / pathlib.Path('notebooks/communicator.ipynb')) as handle:
>           fixture.check(handle)

test/rmq/test_rmq_thread_communicator.py:269: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/home/sph/.virtualenvs/aiida_dev/lib/python3.9/site-packages/pytest_notebook/execution.py:262: in execute_notebook
    proc.preprocess(new_notebook, resources)
/home/sph/.virtualenvs/aiida_dev/lib/python3.9/site-packages/pytest_notebook/execution.py:159: in preprocess
    nb, resources = super(ExecutePreprocessor, self).preprocess(
/home/sph/.virtualenvs/aiida_dev/lib/python3.9/site-packages/nbconvert/preprocessors/base.py:69: in preprocess
    nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
/home/sph/.virtualenvs/aiida_dev/lib/python3.9/site-packages/pytest_notebook/execution.py:175: in preprocess_cell
    return super().preprocess_cell(cell, resources, cell_index)
/home/sph/.virtualenvs/aiida_dev/lib/python3.9/site-packages/nbconvert/preprocessors/execute.py:438: in preprocess_cell
    reply, outputs = self.run_cell(cell, cell_index, store_history)
/home/sph/.virtualenvs/aiida_dev/lib/python3.9/site-packages/nbconvert/preprocessors/execute.py:578: in run_cell
    exec_reply = self._poll_for_reply(parent_msg_id, cell, timeout)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pytest_notebook.execution.ExecuteCoveragePreprocessor object at 0x7f7e4d40e9a0>, msg_id = '3b785650-759ab2172974b2accbec6521_76727_1'
cell = {'cell_type': 'code', 'execution_count': 1, 'metadata': {'pycharm': {'name': '#%%\n'}}, 'outputs': [], 'source': 'impo...turn "Thanks!"\n\n\ncomm.add_rpc_subscriber(rpc_call, \'tester\')\n\nresponse = comm.rpc_send(\'tester\', \'hello!\')'}
timeout = 1

    def _poll_for_reply(self, msg_id, cell=None, timeout=None):
        try:
            # check with timeout if kernel is still alive
            msg = self.kc.shell_channel.get_msg(timeout=timeout)
>           if msg['parent_header'].get('msg_id') == msg_id:
E           TypeError: 'coroutine' object is not subscriptable

This seems to come from @chrisjsewell 's pytest-notebook library. Any ideas why msg is still a coroutine and not resolved to what it is expected to be?

@chrisjsewell
Copy link
Member

See chrisjsewell/pytest-notebook#17, I'll try and whip up a fix today

@codecov
Copy link

codecov bot commented Jan 17, 2022

Codecov Report

Merging #108 (e7431b1) into develop (cfc0498) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #108   +/-   ##
========================================
  Coverage    90.34%   90.34%           
========================================
  Files           16       16           
  Lines         1138     1138           
========================================
  Hits          1028     1028           
  Misses         110      110           
Impacted Files Coverage Δ
kiwipy/communications.py 92.97% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cfc0498...e7431b1. Read the comment docs.

@chrisjsewell
Copy link
Member

chrisjsewell commented Jan 17, 2022

Ok all fixed:

  1. You made me spend all day updating pytest-notebook lol
  2. It now supports python>=3.7, so I changed that here as well (inline with our support policy anyway)
  3. https://github.com/pytest-dev/pytest-asyncio/releases/tag/v0.17.0 (just released) is failing with some weird errors (maybe incompatible with pytest~=5.4), so pinned to <0.17

@sphuber
Copy link
Collaborator

sphuber commented Jan 17, 2022

3. https://github.com/pytest-dev/pytest-asyncio/releases/tag/v0.17.0 (just released) is failing with some weird errors (maybe incompatible with pytest~=5.4), so pinned to <0.17

Indeed, had already encountered this with aiida-core and opened an issue. Also had to pin it temporarily

Copy link
Collaborator

@sphuber sphuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @muhrin and @chrisjsewell

@sphuber sphuber merged commit c35668d into aiidateam:develop Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants