Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Refactor Module Structure and Tests for Star Payments Classes#4615

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Bibo-Joshi merged 6 commits intomasterfromstars-refactoring
Dec 29, 2024

Conversation

Bibo-Joshi
Copy link
Member

closes#4593

@Bibo-JoshiBibo-Joshi added the 🛠 refactorchange type: refactor labelDec 29, 2024
Copy link
Member

@harshil21harshil21 left a comment

Choose a reason for hiding this comment

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

just 2 typos :)

Bibo-Joshi reacted with hooray emoji
@codecovCodecov
Copy link

codecovbot commentedDec 29, 2024
edited
Loading

❌ 1 Tests Failed:

Tests completedFailedPassedSkipped
637116370454
View the top 1 failed tests by shortest run time
tests.ext.test_application.TestApplication::test_stop_running[polling]
Stack Traces | 0.515s run time
self=<tests.ext.test_application.TestApplicationobjectat0x7f1205dc5450>one_time_bot=PytestExtBot[token=640208943:AAFhBjQp9qm3RTxSzUpYzBQjCle-Jjz5hck]monkeypatch=<_pytest.monkeypatch.MonkeyPatchobjectat0x7f1201ed4e20>method='polling'@pytest.mark.parametrize("method", ["polling","webhook"])deftest_stop_running(self,one_time_bot,monkeypatch,method):# asyncio.Event() seems to be hard to use across different threads (awaiting in main# thread, setting in another thread), so we use threading.Event() instead.# This requires the use of run_in_executor, but that's fine.put_update_event=threading.Event()callback_done_event=threading.Event()called_stop_running=threading.Event()assertions= {}asyncdefpost_init(app):# Simply calling app.update_queue.put_nowait(method) in the thread_target doesn't work# for some reason (probably threading magic), so we use an event from the thread_target# to put the update into the queue in the main thread.asyncdeftask(app):awaitasyncio.get_running_loop().run_in_executor(None,put_update_event.wait)awaitapp.update_queue.put(method)app.create_task(task(app))app= (ApplicationBuilder()            .application_class(PytestApplication)            .updater(PytestUpdater(one_time_bot,asyncio.Queue()))            .post_init(post_init)            .build()        )monkeypatch.setattr(app.bot,"get_updates",empty_get_updates)events= []monkeypatch.setattr(app.updater,"stop",call_after(app.updater.stop,lambda_:events.append("updater.stop")),        )monkeypatch.setattr(app,"stop",call_after(app.stop,lambda_:events.append("app.stop")),        )monkeypatch.setattr(app,"shutdown",call_after(app.shutdown,lambda_:events.append("app.shutdown")),        )monkeypatch.setattr(app.bot,"set_webhook",return_true)monkeypatch.setattr(app.bot,"delete_webhook",return_true)defthread_target():waited=0whilenotapp.running:time.sleep(0.05)waited+=0.05ifwaited>5:pytest.fail("App apparently won't start")time.sleep(0.1)assertions["called_stop_running_not_set"]=notcalled_stop_running.is_set()put_update_event.set()time.sleep(0.1)assertions["called_stop_running_set"]=called_stop_running.is_set()# App should have entered `stop` now but not finished it yet because the callback# is still runningassertions["updater.stop_event"]=events== ["updater.stop"]assertions["app.running_False"]=notapp.runningcallback_done_event.set()time.sleep(0.1)# Now that the update is fully handled, we expect the full shutdownassertions["events"]=events== ["updater.stop","app.stop","app.shutdown"]asyncdefcallback(update,context):context.application.stop_running()called_stop_running.set()awaitasyncio.get_running_loop().run_in_executor(None,callback_done_event.wait)app.add_handler(TypeHandler(object,callback))thread=Thread(target=thread_target)thread.start()ifmethod=="polling":app.run_polling(close_loop=False,drop_pending_updates=True)else:ip="127.0.0.1"port=randrange(1024,49152)app.run_webhook(ip_address=ip,port=port,url_path="TOKEN",drop_pending_updates=False,close_loop=False,            )thread.join()assertlen(assertions)==5forkey,valueinassertions.items():>assertvalue,f"assertion '{key}' failed!"EAssertionError:assertion'called_stop_running_set'failed!EassertFalsetests/ext/test_application.py:2547:AssertionError

To view more test analytics, go to theTest Analytics Dashboard
📢 Thoughts on this report?Let us know!

Copy link
Member

@harshil21harshil21 left a comment

Choose a reason for hiding this comment

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

lgtm

@Bibo-JoshiBibo-Joshi merged commitdf20e49 intomasterDec 29, 2024
23 checks passed
@Bibo-JoshiBibo-Joshi deleted the stars-refactoring branchDecember 29, 2024 16:58
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJan 6, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@harshil21harshil21harshil21 approved these changes

@PoolitzerPoolitzerAwaiting requested review from Poolitzer

Assignees
No one assigned
Labels
🛠 refactorchange type: refactor
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Refactortest_stars
2 participants
@Bibo-Joshi@harshil21

[8]ページ先頭

©2009-2025 Movatter.jp