René's URL Explorer Experiment


Title: allure-pytest raises an exception when writing to log from a thread started inside pytest_generate_tests · Issue #757 · allure-framework/allure-python · GitHub

Open Graph Title: allure-pytest raises an exception when writing to log from a thread started inside pytest_generate_tests · Issue #757 · allure-framework/allure-python

X Title: allure-pytest raises an exception when writing to log from a thread started inside pytest_generate_tests · Issue #757 · allure-framework/allure-python

Description: I'm submitting a ... bug report What is the current behavior? I have a function that creates a thread which writes some information in the log. When I try to call it from pytest_generate_tests allure-pytest raises the following StopItera...

Open Graph Description: I'm submitting a ... bug report What is the current behavior? I have a function that creates a thread which writes some information in the log. When I try to call it from pytest_generate_tests allu...

X Description: I'm submitting a ... bug report What is the current behavior? I have a function that creates a thread which writes some information in the log. When I try to call it from pytest_generate_tests ...

Opengraph URL: https://github.com/allure-framework/allure-python/issues/757

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"allure-pytest raises an exception when writing to log from a thread started inside pytest_generate_tests","articleBody":"#### I'm submitting a ... \r\n  - [x] bug report\r\n\r\n#### What is the current behavior?\r\nI have a function that creates a thread which writes some information in the log. When I try to call it from `pytest_generate_tests` allure-pytest raises the following `StopIteration` exception:\r\n```\r\nplatform linux -- Python 3.9.16, pytest-7.4.0, pluggy-1.2.0\r\nrootdir: /mnt/c/storage/allure_bug\r\nplugins: allure-pytest-2.13.2\r\ncollecting ... Exception in thread Thread-1:\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python3.9/threading.py\", line 980, in _bootstrap_inner\r\n    self.run()\r\n  File \"/usr/lib/python3.9/threading.py\", line 917, in run\r\n    self._target(*self._args, **self._kwargs)\r\n  File \"/mnt/c/storage/allure_bug/conftest.py\", line 17, in _thread\r\n    log.warning('thread')\r\n  File \"/usr/lib/python3.9/logging/init.py\", line 1458, in warning\r\n    self._log(WARNING, msg, args, **kwargs)\r\n  File \"/usr/lib/python3.9/logging/init.py\", line 1589, in _log\r\n    self.handle(record)\r\n  File \"/usr/lib/python3.9/logging/init.py\", line 1599, in handle\r\n    self.callHandlers(record)\r\n  File \"/usr/lib/python3.9/logging/init.py\", line 1661, in callHandlers\r\n    hdlr.handle(record)\r\n  File \"/usr/lib/python3.9/logging/init.py\", line 952, in handle\r\n    self.emit(record)\r\n  File \"/mnt/c/storage/allure_bug/conftest.py\", line 9, in emit\r\n    with step(f'[{record.levelname}] {record.getMessage()}'):\r\n  File \"/tmp/test_venv/lib/python3.9/site-packages/allure_commons/_allure.py\", line 179, in enter\r\n    plugin_manager.hook.start_step(uuid=self.uuid, title=self.title, params=self.params)\r\n  File \"/tmp/test_venv/lib/python3.9/site-packages/pluggy/_hooks.py\", line 433, in call\r\n    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)\r\n  File \"/tmp/test_venv/lib/python3.9/site-packages/pluggy/_manager.py\", line 112, in _hookexec\r\n    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)\r\n  File \"/tmp/test_venv/lib/python3.9/site-packages/pluggy/_callers.py\", line 116, in _multicall\r\n    raise exception.with_traceback(exception.traceback)\r\n  File \"/tmp/test_venv/lib/python3.9/site-packages/pluggy/_callers.py\", line 80, in _multicall\r\n    res = hook_impl.function(*args)\r\n  File \"/tmp/test_venv/lib/python3.9/site-packages/allure_pytest/listener.py\", line 48, in start_step\r\n    self.allure_logger.start_step(None, uuid, step)\r\n  File \"/tmp/test_venv/lib/python3.9/site-packages/allure_commons/reporter.py\", line 128, in start_step\r\n    parent_uuid = parent_uuid if parent_uuid else self._last_executable()\r\n  File \"/tmp/test_venv/lib/python3.9/site-packages/allure_commons/reporter.py\", line 71, in _last_executable\r\n    for _uuid in reversed(self._items):\r\n  File \"/tmp/test_venv/lib/python3.9/site-packages/allure_commons/reporter.py\", line 39, in reversed\r\n    return self.thread_context.reversed()\r\n  File \"/tmp/test_venv/lib/python3.9/site-packages/allure_commons/reporter.py\", line 21, in thread_context\r\n    uuid, last_item = next(reversed(self._thread_context[self._init_thread].items()))\r\nStopIteration\r\ncollected 1 item\r\n\r\ntest_bug.py test\r\n.\r\n```\r\n\r\n#### If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem\r\n1. Install requirements `pip install pytest allure-pytest`\r\n2. Prepare the demo test suite:\r\n\r\nconftest.py\r\n```python\r\nimport logging\r\nfrom threading import Thread\r\n\r\nfrom allure import step\r\n\r\nclass AllureLoggerHandler(logging.Handler):\r\n    def emit(self, record):\r\n        with step(f'[{record.levelname}] {record.getMessage()}'):\r\n            pass\r\n\r\nlog = logging.getLogger()\r\nallure_handler = AllureLoggerHandler()\r\nlog.addHandler(allure_handler)\r\n\r\ndef _thread():\r\n    log.warning('thread')\r\n\r\ndef pytest_generate_tests(metafunc):\r\n    log.info('generate')\r\n    thread = Thread(target=_thread)\r\n    thread.start()\r\n    thread.join(100)\r\n```\r\ntest_bug.py\r\n```python\r\ndef test_allure_log():\r\n    print('test')\r\n```\r\n3. Run test: `pytest -s --alluredir=./allure`\r\n\r\n#### What is the expected behavior?\r\nTest suite works without any exceptions\r\n\r\n#### What is the motivation / use case for changing the behavior?\r\n\r\n\r\n#### Please tell us about your environment:\r\n\r\n- Allure version:        2.22.0\r\n- Test framework:     pytest 7.4.0\r\n- Allure adaptor:       allure-pytest 2.13.2\r\n\r\n#### Other information \r\n\r\n[//]: # (\r\n. e.g. detailed explanation, stacktraces, related issues, suggestions \r\n. how to fix, links for us to have more context, eg. Stackoverflow, Gitter etc\r\n)\r\n","author":{"url":"https://github.com/eltimen","@type":"Person","name":"eltimen"},"datePublished":"2023-08-04T20:47:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/757/allure-python/issues/757"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:c5718b3c-a0f7-eea8-8441-d47a1f9e7eef
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE866:37483B:3F75F0:59218D:696F9CFC
html-safe-nonce3cb84cdfd1256933ad458906f60cc62967d1dfb4f96f5f4b9ecd3d51385e1924
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODY2OjM3NDgzQjozRjc1RjA6NTkyMThEOjY5NkY5Q0ZDIiwidmlzaXRvcl9pZCI6IjY0MTI1MjI3MjQ1OTIxNjQwOTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacb32667fd0a85e8018abebda3282a36498852aaf90da72a5e5c3b142509f83136
hovercard-subject-tagissue:1837320649
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/allure-framework/allure-python/757/issue_layout
twitter:imagehttps://opengraph.githubassets.com/55c906f2d4e56d66e5e22a50dcc1a874e0458243ba50377e58a6a5fac30be48d/allure-framework/allure-python/issues/757
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/55c906f2d4e56d66e5e22a50dcc1a874e0458243ba50377e58a6a5fac30be48d/allure-framework/allure-python/issues/757
og:image:altI'm submitting a ... bug report What is the current behavior? I have a function that creates a thread which writes some information in the log. When I try to call it from pytest_generate_tests allu...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameeltimen
hostnamegithub.com
expected-hostnamegithub.com
None0ca8d8c65612640b9a1a588b3eed68222ca723ed2d028b18fe81b28936d535eb
turbo-cache-controlno-preview
go-importgithub.com/allure-framework/allure-python git https://github.com/allure-framework/allure-python.git
octolytics-dimension-user_id5879127
octolytics-dimension-user_loginallure-framework
octolytics-dimension-repository_id79346720
octolytics-dimension-repository_nwoallure-framework/allure-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id79346720
octolytics-dimension-repository_network_root_nwoallure-framework/allure-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release95f60616ce2765d1114fe6da4af405a58c6d26d2
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/allure-framework/allure-python/issues/757#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fallure-framework%2Fallure-python%2Fissues%2F757
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fallure-framework%2Fallure-python%2Fissues%2F757
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=allure-framework%2Fallure-python
Reloadhttps://patch-diff.githubusercontent.com/allure-framework/allure-python/issues/757
Reloadhttps://patch-diff.githubusercontent.com/allure-framework/allure-python/issues/757
Reloadhttps://patch-diff.githubusercontent.com/allure-framework/allure-python/issues/757
allure-framework https://patch-diff.githubusercontent.com/allure-framework
allure-pythonhttps://patch-diff.githubusercontent.com/allure-framework/allure-python
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fallure-framework%2Fallure-python
Fork 256 https://patch-diff.githubusercontent.com/login?return_to=%2Fallure-framework%2Fallure-python
Star 789 https://patch-diff.githubusercontent.com/login?return_to=%2Fallure-framework%2Fallure-python
Code https://patch-diff.githubusercontent.com/allure-framework/allure-python
Issues 95 https://patch-diff.githubusercontent.com/allure-framework/allure-python/issues
Pull requests 20 https://patch-diff.githubusercontent.com/allure-framework/allure-python/pulls
Actions https://patch-diff.githubusercontent.com/allure-framework/allure-python/actions
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/allure-framework/allure-python/security
Please reload this pagehttps://patch-diff.githubusercontent.com/allure-framework/allure-python/issues/757
Insights https://patch-diff.githubusercontent.com/allure-framework/allure-python/pulse
Code https://patch-diff.githubusercontent.com/allure-framework/allure-python
Issues https://patch-diff.githubusercontent.com/allure-framework/allure-python/issues
Pull requests https://patch-diff.githubusercontent.com/allure-framework/allure-python/pulls
Actions https://patch-diff.githubusercontent.com/allure-framework/allure-python/actions
Security https://patch-diff.githubusercontent.com/allure-framework/allure-python/security
Insights https://patch-diff.githubusercontent.com/allure-framework/allure-python/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/allure-framework/allure-python/issues/757
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/allure-framework/allure-python/issues/757
allure-pytest raises an exception when writing to log from a thread started inside pytest_generate_testshttps://patch-diff.githubusercontent.com/allure-framework/allure-python/issues/757#top
bugSomething isn't workinghttps://github.com/allure-framework/allure-python/issues?q=state%3Aopen%20label%3A%22bug%22
theme:corehttps://github.com/allure-framework/allure-python/issues?q=state%3Aopen%20label%3A%22theme%3Acore%22
theme:pytesthttps://github.com/allure-framework/allure-python/issues?q=state%3Aopen%20label%3A%22theme%3Apytest%22
https://github.com/eltimen
https://github.com/eltimen
eltimenhttps://github.com/eltimen
on Aug 4, 2023https://github.com/allure-framework/allure-python/issues/757#issue-1837320649
bugSomething isn't workinghttps://github.com/allure-framework/allure-python/issues?q=state%3Aopen%20label%3A%22bug%22
theme:corehttps://github.com/allure-framework/allure-python/issues?q=state%3Aopen%20label%3A%22theme%3Acore%22
theme:pytesthttps://github.com/allure-framework/allure-python/issues?q=state%3Aopen%20label%3A%22theme%3Apytest%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.