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

Update pytest-xdist Usage #4491

Merged
merged 4 commits into from
Sep 22, 2024
Merged

Update pytest-xdist Usage #4491

merged 4 commits into from
Sep 22, 2024

Conversation

Bibo-Joshi
Copy link
Member

Trying to get things for #4271 done in smaller chunks
Also addresses one point from #4324

harshil21 and others added 2 commits September 21, 2024 15:15

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@Bibo-Joshi Bibo-Joshi added the ⚙️ tests affected functionality: tests label Sep 21, 2024
@Bibo-Joshi Bibo-Joshi changed the title Pytest xdist Update pytest-xdist Usage Sep 21, 2024
Co-authored-by: Harshil <37377066+harshil21@users.noreply.github.com>
@harshil21
Copy link
Member

This simple configuration change seems to reduce CI test time by about 1 min on average.

# Conflicts:
#	.github/workflows/unit_tests.yml
Copy link

codecov bot commented Sep 22, 2024

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
5984 1 5983 278
View the top 1 failed tests by shortest run time
tests.ext.test_basepersistence.TestBasePersistence test_update_persistence_loop_saved_data_job[all_data]
Stack Traces | 2.57s run time
self = &lt;tests.ext.test_basepersistence.TestBasePersistence object at 0x000001EB8B12E350&gt;
papp = PytestApplication[bot=PytestExtBot[token=690091347:AAFLmR5pAB5Ycpe_mOh7zM4JFBOh0z3T0To]]
chat_id = '675666224'

    @papp_store_all_or_none
    async def test_update_persistence_loop_saved_data_job(self, papp: Application, chat_id):
        papp.add_handler(
            MessageHandler(filters.ALL, callback=self.handler_callback(chat_id=chat_id)), group=-1
        )
    
        async with papp:
            await papp.job_queue.start()
            papp.job_queue.run_once(
                self.job_callback(chat_id=chat_id), when=1.5, chat_id=1, user_id=1
            )
            await asyncio.sleep(2.5)
    
            assert not papp.persistence.bot_data
            assert papp.persistence.bot_data is not papp.bot_data
            assert not papp.persistence.chat_data
            assert papp.persistence.chat_data is not papp.chat_data
            assert not papp.persistence.user_data
            assert papp.persistence.user_data is not papp.user_data
            assert papp.persistence.callback_data == ([], {})
            assert (
                papp.persistence.callback_data is not papp.bot.callback_data_cache.persistence_data
            )
            assert not papp.persistence.conversations
    
            await papp.update_persistence()
    
            assert papp.persistence.bot_data is not papp.bot_data
            if papp.persistence.store_data.bot_data:
                assert papp.persistence.bot_data == {"key": "value", "refreshed": True}
            else:
                assert not papp.persistence.bot_data
    
            assert papp.persistence.chat_data is not papp.chat_data
            if papp.persistence.store_data.chat_data:
&gt;               assert papp.persistence.chat_data == {1: {"key": "value", "refreshed": True}}
E               AssertionError: assert defaultdict(&lt;...s 'dict'&gt;, {}) == {1: {'key': '...eshed': True}}
E                 
E                 Right contains 1 more item:
E                 {1: {'key': 'value', 'refreshed': True}}
E                 
E                 Full diff:
E                 + defaultdict(&lt;class 'dict'&gt;, {})
E                 - {
E                 -     1: {
E                 -         'key': 'value',
E                 -         'refreshed': True,
E                 -     },
E                 - }

tests\ext\test_basepersistence.py:901: AssertionError

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

@Bibo-Joshi Bibo-Joshi merged commit bd3cdbc into master Sep 22, 2024
25 checks passed
@Bibo-Joshi Bibo-Joshi deleted the pytest-xdist branch September 22, 2024 17:49
@github-actions github-actions bot locked and limited conversation to collaborators Sep 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
⚙️ tests affected functionality: tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants