René's URL Explorer Experiment


Title: Adding directory to PymodeRope · Issue #1159 · python-mode/python-mode · GitHub

Open Graph Title: Adding directory to PymodeRope · Issue #1159 · python-mode/python-mode

X Title: Adding directory to PymodeRope · Issue #1159 · python-mode/python-mode

Description: Using the python project scheme suggested by the pytest documentation, pymode does not include the tests/ directory into its ropeproject when the “include method” of the src/ directory is done via an editable install (pip install -e .). ...

Open Graph Description: Using the python project scheme suggested by the pytest documentation, pymode does not include the tests/ directory into its ropeproject when the “include method” of the src/ directory is done via ...

X Description: Using the python project scheme suggested by the pytest documentation, pymode does not include the tests/ directory into its ropeproject when the “include method” of the src/ directory is done via ...

Opengraph URL: https://github.com/python-mode/python-mode/issues/1159

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Adding directory to PymodeRope","articleBody":"Using the [python project scheme suggested by the pytest documentation](https://docs.pytest.org/en/7.1.x/explanation/goodpractices.html#tests-outside-application-code), pymode does not include the `tests/` directory into its `ropeproject` when the “include method” of the `src/` directory is done via an editable install (`pip install -e .`).\r\n\r\nHow do I add an additional source directory to `PymodeRope`, namely the `tests/` directory?\r\n\r\n### Minimal working example\r\nFirst create a `venv` virtual environment as well as a temporary directory. The abbreviation `pmt` stands for “pymode test”.\r\n```bash\r\n$ mkdir -p /tmp/pmt/{.venv,src/pmt,tests}\r\n$ cd /tmp/pmt\r\n$ python -m venv /tmp/pmt/.venv/pmt\r\n$ source /tmp/pmt/.venv/pmt/bin/activate\r\n(pmt) $ python -m pip install -U pip\r\n(pmt) $ python -m pip install build pytest\r\n(pmt) $ touch pyproject.toml src/pmt/__init__.py\r\n```\r\nCreate the three source files with an editor of your choice, namely\r\n* ```python\r\n  # ––– file /tmp/pmt/src/pmt/spam.py\r\n  def spamfunc() -> int:\r\n      return 1\r\n  ```\r\n* ```python\r\n  # ––– file /tmp/pmt/src/pmt/bacon.py\r\n  from .spam import spamfunc\r\n  \r\n  \r\n  def baconfunc() -> None:\r\n      return 1 + spamfunc()\r\n  ```\r\n* ```python\r\n  # ––– file /tmp/pmt/tests/test_pmt.py\r\n  from pmt.bacon import baconfunc\r\n  from pmt.spam import spamfunc\r\n  \r\n  \r\n  def test_baconfunc() -> None:\r\n      assert 2 == baconfunc()\r\n  \r\n  \r\n  def test_spamfunc() -> None:\r\n      assert 1 == spamfunc()\r\n  ```\r\nThe project directory will look like this:\r\n```\r\n.\r\n├── pyproject.toml\r\n├── src\r\n│   └── pmt\r\n│       ├── bacon.py\r\n│       ├── __init__.py\r\n│       └── spam.py\r\n└── tests\r\n    └── test_pmt.py\r\n```\r\nAs suggested by `pytest`, install the editable version of the package and invoke `pytest`:\r\n```text\r\n(pmt) $ python -m pip install -e .\r\n(pmt) $ python -m pytest\r\n================================ test session starts =================================\r\nplatform linux -- Python 3.10.6, pytest-7.1.3, pluggy-1.0.0\r\nrootdir: /tmp/pmt\r\ncollected 2 items                                                                    \r\n\r\ntests/test_pmt.py ..                                                           [100%]\r\n\r\n================================= 2 passed in 0.01s ==================================\r\n```\r\nTo finally reproduce the behaviour:\r\n* open the source file with `vim /tmp/pmt/src/pmt/spam.py`\r\n* move the cursor to `spamfunc`\r\n* start function renaming by hitting `\u003cC-c>rr`\r\n* insert a different name, for instance `hamfunc` and press `\u003cEnter>`\r\n* perform the renaming by inserting `1\u003cEnter>`\r\n\r\nAfter that, the renaming was successfully done in `/tmp/pmt/src/pmt/spam.py` and `/tmp/pmt/src/pmt/bacon.py` _but not in_ `tmp/pmt/tests/test_pmt.py` (as I expect).\r\n\r\n### What I have tried\r\nI tried to add manually the `tests` directory to the `.ropeproject/config.py` file\r\n```python\r\ndef set_prefs(prefs):\r\n    # … more code of the default config.py file …\r\n\r\n    # Custom source folders:  By default rope searches the project\r\n    # for finding source folders (folders that should be searched\r\n    # for finding modules).  You can add paths to that list.  Note\r\n    # that rope guesses project source folders correctly most of the\r\n    # time; use this if you have any problems.\r\n    # The folders should be relative to project root and use '/' for\r\n    # separating folders regardless of the platform rope is running on.\r\n    # 'src/my_source_folder' for instance.\r\n    prefs.add('source_folders', 'tests')\r\n\r\n    # … more code of the default config.py file …\r\n```\r\nwith no success.\r\n\r\nWhen I change the import policy by\r\n* uninstalling the module again with `(pmt) $ python -m pip uninstall pmt`\r\n* change the imports of `tmp/pmt/tests/test_pmt.py` to\r\n  ```python\r\n  from src.pmt.bacon import baconfunc\r\n  from src.pmt.spam import spamfunc\r\n  ```\r\n\r\nthen the renaming as suggested above _does work_, but that project structure is _not_ as I or the `pytest` guys, respectively, want it to be.\r\n\r\n### Used versions\r\n```bash\r\n(pmt) $ python --version\r\nPython 3.10.6\r\n(pmt) $ python -m pip freeze | grep 'build\\|pytest'\r\nbuild==0.8.0\r\npytest==7.1.3\r\n```\r\n\r\nPymode version: `commit 85d2cd1a196ac1def79d4599b5be69395ed5b603 (HEAD → develop)`","author":{"url":"https://github.com/claudio-ebel","@type":"Person","name":"claudio-ebel"},"datePublished":"2022-09-06T23:02:13Z","url":"https://github.com/python-mode/python-mode/issues/1159"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6f7056f1-a37f-062e-3fed-0b4d750f8d63
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8D92:3D4084:520091:6BAAC2:6AFE66D3
html-safe-nonce9c0020a892ed1f0f3c3cbfcbdef057aa824579c6c42484c977e2d64082bb3740
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RDkyOjNENDA4NDo1MjAwOTE6NkJBQUMyOjZBRkU2NkQzIiwidmlzaXRvcl9pZCI6IjE4Njg4MTE3MzYyNDU0OTU1MDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac32ba63a7f7b52de0bf784bbeb1a80cf9b2145ac5d7c30c6c6343b0de35384b99
hovercard-subject-tagissue:1363897855
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/python-mode/python-mode/1159/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4aa5357a34b3bbce2609e9aa598b1a694b107fcfecacc857d24ba3a936726991/python-mode/python-mode/issues/1159
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4aa5357a34b3bbce2609e9aa598b1a694b107fcfecacc857d24ba3a936726991/python-mode/python-mode/issues/1159
og:image:altUsing the python project scheme suggested by the pytest documentation, pymode does not include the tests/ directory into its ropeproject when the “include method” of the src/ directory is done via ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameclaudio-ebel
hostnamegithub.com
expected-hostnamegithub.com
Noneb3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86
turbo-cache-controlno-preview
go-importgithub.com/python-mode/python-mode git https://github.com/python-mode/python-mode.git
octolytics-dimension-user_id13965098
octolytics-dimension-user_loginpython-mode
octolytics-dimension-repository_id2408911
octolytics-dimension-repository_nwopython-mode/python-mode
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id2408911
octolytics-dimension-repository_network_root_nwopython-mode/python-mode
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
release4a10310af51a1bfffbedc4fd81cb582acf0cb0ff
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python-mode/python-mode/issues/1159#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-mode%2Fpython-mode%2Fissues%2F1159
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython-mode%2Fpython-mode%2Fissues%2F1159
Sign uphttps://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=python-mode%2Fpython-mode
Reloadhttps://github.com/python-mode/python-mode/issues/1159
Reloadhttps://github.com/python-mode/python-mode/issues/1159
Reloadhttps://github.com/python-mode/python-mode/issues/1159
python-modehttps://github.com/python-mode
python-modehttps://github.com/python-mode/python-mode
Codehttps://github.com/python-mode/python-mode
Issues38 (38)https://github.com/python-mode/python-mode/issues
Pull requests1 (1)https://github.com/python-mode/python-mode/pulls
Actionshttps://github.com/python-mode/python-mode/actions
Projectshttps://github.com/python-mode/python-mode/projects
Wikihttps://github.com/python-mode/python-mode/wiki
Security and qualityhttps://github.com/python-mode/python-mode/security
Insightshttps://github.com/python-mode/python-mode/insights
https://github.com/python-mode/python-mode
New issuehttps://github.com/login?return_to=https://github.com/python-mode/python-mode/issues/1159
New issuehttps://github.com/login?return_to=https://github.com/python-mode/python-mode/issues/1159
Adding directory to PymodeRopehttps://github.com/python-mode/python-mode/issues/1159#top
https://github.com/claudio-ebel
claudio-ebelhttps://github.com/claudio-ebel
on Sep 6, 2022https://github.com/python-mode/python-mode/issues/1159#issue-1363897855
python project scheme suggested by the pytest documentationhttps://docs.pytest.org/en/7.1.x/explanation/goodpractices.html#tests-outside-application-code
Sign up for freehttps://github.com/signup?return_to=https://github.com/python-mode/python-mode/issues/1159
Sign in to commenthttps://github.com/login?return_to=https://github.com/python-mode/python-mode/issues/1159
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.