René's URL Explorer Experiment


Title: Section 2.1: Note on `python3 -m pytest` is incorrect · Issue #18 · bham-carpentries/python-intermediate-development · GitHub

Open Graph Title: Section 2.1: Note on `python3 -m pytest` is incorrect · Issue #18 · bham-carpentries/python-intermediate-development

X Title: Section 2.1: Note on `python3 -m pytest` is incorrect · Issue #18 · bham-carpentries/python-intermediate-development

Description: The note: ## Why Run Pytest Using `python3 -m pytest` and Not `pytest`? `pytest` is another Python module that can be run via its own command but this is a good example why invoking Python modules via `python3 -m` may be better (recall t...

Open Graph Description: The note: ## Why Run Pytest Using `python3 -m pytest` and Not `pytest`? `pytest` is another Python module that can be run via its own command but this is a good example why invoking Python modules ...

X Description: The note: ## Why Run Pytest Using `python3 -m pytest` and Not `pytest`? `pytest` is another Python module that can be run via its own command but this is a good example why invoking Python modules ...

Opengraph URL: https://github.com/bham-carpentries/python-intermediate-development/issues/18

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Section 2.1: Note on `python3 -m pytest` is incorrect","articleBody":"The note:\n\n```markdown\n## Why Run Pytest Using `python3 -m pytest` and Not `pytest`?\n\n`pytest` is another Python module that can be run via its own command but this is a good example\nwhy invoking Python modules via `python3 -m` may be better (recall the [explanation of Python interpreter's `-m` flag](12-virtual-environments.md)).\nHad we used `pytest tests/test_models.py` command directly,\nthis would have led to a \"ModuleNotFoundError: No module named 'inflammation'\" error. This is\nbecause `pytest` command (unlike `python3 -m pytest`) does not add the current directory to its list of\ndirectories to search for modules, hence the `inflammation` subdirectory's contents are not being\n'seen' by `pytest` causing the `ModuleNotFoundError`. There are ways to work around this problem\nbut `python3 -m pytest` ensures it does not happen in the first place.\n```\n\nThis is wrong. Counter example:\n\n```bash\npytest tests/test_models.py\n```\n\noutputs:\n\n```console\n=================================================== test session starts ====================================================\nplatform darwin -- Python 3.12.9, pytest-8.3.5, pluggy-1.5.0\nrootdir: /Users/***/Repos/github.com/***/python-intermediate-inflammation\nconfigfile: pyproject.toml\ncollected 2 items                                                                                                          \n\ntests/test_models.py ..                                                                                              [100%]\n\n==================================================== 2 passed in 0.06s =====================================================\n```\n\n### Environment\n\n- OS: macOS 15.3.2\n- See pytest output above\n","author":{"url":"https://github.com/alexlyttle","@type":"Person","name":"alexlyttle"},"datePublished":"2025-04-01T14:08:40.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/18/python-intermediate-development/issues/18"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:8fbb01c9-dbc7-51ed-5684-685de4434ddd
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD306:205C7C:1CF33EF:29C5DAA:6A4BD266
html-safe-nonce277aed886a07a32a1d12fb2cd6c8ba548f298233bbb61237f7c82c4af56cc31a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzA2OjIwNUM3QzoxQ0YzM0VGOjI5QzVEQUE6NkE0QkQyNjYiLCJ2aXNpdG9yX2lkIjoiNTkzMzg0MzMwNjU5Mjg1MDUzNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac394908a17fdbacb0e943fbc881f23c5c5533e73cca5f0cc80f0336c6af894eaa
hovercard-subject-tagissue:2963581829
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/bham-carpentries/python-intermediate-development/18/issue_layout
twitter:imagehttps://opengraph.githubassets.com/048e41507d704dea893fea80003702cda92e281a37e14c3361b7523945697c2b/bham-carpentries/python-intermediate-development/issues/18
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/048e41507d704dea893fea80003702cda92e281a37e14c3361b7523945697c2b/bham-carpentries/python-intermediate-development/issues/18
og:image:altThe note: ## Why Run Pytest Using `python3 -m pytest` and Not `pytest`? `pytest` is another Python module that can be run via its own command but this is a good example why invoking Python modules ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamealexlyttle
hostnamegithub.com
expected-hostnamegithub.com
None9df996be9551ac02247d09a2f7f64ece66c35ca28885d346e98fdfda9cdaa37b
turbo-cache-controlno-preview
go-importgithub.com/bham-carpentries/python-intermediate-development git https://github.com/bham-carpentries/python-intermediate-development.git
octolytics-dimension-user_id41366779
octolytics-dimension-user_loginbham-carpentries
octolytics-dimension-repository_id928344524
octolytics-dimension-repository_nwobham-carpentries/python-intermediate-development
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forktrue
octolytics-dimension-repository_parent_id257930838
octolytics-dimension-repository_parent_nwocarpentries-incubator/python-intermediate-development
octolytics-dimension-repository_network_root_id257930838
octolytics-dimension-repository_network_root_nwocarpentries-incubator/python-intermediate-development
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
releaseb71208a1c9ec7ccf364087569d0551f665dda674
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/bham-carpentries/python-intermediate-development/issues/18#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fbham-carpentries%2Fpython-intermediate-development%2Fissues%2F18
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
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
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
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://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fbham-carpentries%2Fpython-intermediate-development%2Fissues%2F18
Sign up https://github.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=bham-carpentries%2Fpython-intermediate-development
Reloadhttps://github.com/bham-carpentries/python-intermediate-development/issues/18
Reloadhttps://github.com/bham-carpentries/python-intermediate-development/issues/18
Reloadhttps://github.com/bham-carpentries/python-intermediate-development/issues/18
Please reload this pagehttps://github.com/bham-carpentries/python-intermediate-development/issues/18
bham-carpentries https://github.com/bham-carpentries
python-intermediate-developmenthttps://github.com/bham-carpentries/python-intermediate-development
carpentries-incubator/python-intermediate-developmenthttps://github.com/carpentries-incubator/python-intermediate-development
Notifications https://github.com/login?return_to=%2Fbham-carpentries%2Fpython-intermediate-development
Fork 0 https://github.com/login?return_to=%2Fbham-carpentries%2Fpython-intermediate-development
Star 1 https://github.com/login?return_to=%2Fbham-carpentries%2Fpython-intermediate-development
Code https://github.com/bham-carpentries/python-intermediate-development
Issues 20 https://github.com/bham-carpentries/python-intermediate-development/issues
Pull requests 0 https://github.com/bham-carpentries/python-intermediate-development/pulls
Actions https://github.com/bham-carpentries/python-intermediate-development/actions
Projects https://github.com/bham-carpentries/python-intermediate-development/projects
Security and quality 0 https://github.com/bham-carpentries/python-intermediate-development/security
Insights https://github.com/bham-carpentries/python-intermediate-development/pulse
Code https://github.com/bham-carpentries/python-intermediate-development
Issues https://github.com/bham-carpentries/python-intermediate-development/issues
Pull requests https://github.com/bham-carpentries/python-intermediate-development/pulls
Actions https://github.com/bham-carpentries/python-intermediate-development/actions
Projects https://github.com/bham-carpentries/python-intermediate-development/projects
Security and quality https://github.com/bham-carpentries/python-intermediate-development/security
Insights https://github.com/bham-carpentries/python-intermediate-development/pulse
Section 2.1: Note on python3 -m pytest is incorrecthttps://github.com/bham-carpentries/python-intermediate-development/issues/18#top
https://github.com/alexlyttle
alexlyttlehttps://github.com/alexlyttle
on Apr 1, 2025https://github.com/bham-carpentries/python-intermediate-development/issues/18#issue-2963581829
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.