Skip to content

Conversation

Bibo-Joshi
Copy link
Member

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

@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.

2 participants