
GITHUB . COM {
}
Detected CMS Systems:
- Wordpress (2 occurrences)
Title:
`KeyError` fired from `importlib` during collection when running with `--import-mode=importlib` on a directory containing a same-named one Β· Issue #12592 Β· pytest-dev/pytest
Description:
A detailed description of the bug or problem you are having When creating the following structure: x/ ββ y/ β ββ y/ β ββ test_y.py then pytest --import-mode=importlib fails with the following cryptic message: ============================...
Website Age:
17 years and 8 months (reg. 2007-10-09).
Matching Content Categories {π}
- Social Networks
- Technology & Computing
- Books & Literature
Content Management System {π}
What CMS is github.com built with?
Github.com relies on WORDPRESS.
Traffic Estimate {π}
What is the average monthly size of github.com audience?
ππ Tremendous Traffic: 10M - 20M visitors per month
Based on our best estimate, this website will receive around 10,000,019 visitors per month in the current month.
However, some sources were not loaded, we suggest to reload the page to get complete results.
check SE Ranking
check Ahrefs
check Similarweb
check Ubersuggest
check Semrush
How Does Github.com Make Money? {πΈ}
Subscription Packages {π³}
We've located a dedicated page on github.com that might include details about subscription plans or recurring payments. We identified it based on the word pricing in one of its internal links. Below, you'll find additional estimates for its monthly recurring revenues.How Much Does Github.com Make? {π°}
Subscription Packages {π³}
Prices on github.com are in US Dollars ($).
They range from $4.00/month to $21.00/month.
We estimate that the site has approximately 4,989,889 paying customers.
The estimated monthly recurring revenue (MRR) is $20,957,532.
The estimated annual recurring revenues (ARR) are $251,490,385.
Wordpress Themes and Plugins {π¨}
What WordPress theme does this site use?
It is strange but we were not able to detect any theme on the page.
What WordPress plugins does this website use?
It is strange but we were not able to detect any plugins on the page.
Keywords {π}
pytest, issue, directory, importmodeimportlib, keyerror, fix, collection, frozen, added, importlib, running, sign, test, directories, valeriupredoi, projects, closed, importlibbootstrapexternal, init, python, zachd, dongfangtianyu, mentioned, nicoddemus, commit, references, mode, navigation, code, pull, requests, actions, security, fired, samenamed, description, bug, fails, return, selfobj, setupmodule, mod, importmoduleusingspec, homeredsuncachepypoetryvirtualenvsfoouhcoqpylibpythonsitepackagespytestpathlibpyimportmoduleusingspec, pip, encountered, topic, related, phase, commented,
Topics {βοΈ}
cache/pypoetry/virtualenvs/foo-4uhc0o_q-py3 10/site-packages/_pytest/runner 10/site-packages/_pytest/pathlib pytest --import-mode=importlib fails 10/site-packages/_pytest/python parameter --import-mode=importlib collection phase type assigned labels topic 6b8827d patchback mentioned stdlib code farm import udder 098e5a6 dongfangtianyu mentioned 7108bb9 nicoddemus closed import-mode=importlib `--import-mode=importlib` optional[tresult] = func minimal poetry env comment metadata assignees type projects add init files projects milestone package-level imports /cow/moo/moo importlib mode detailed description python version collection related init files upstream issue test fails f9fef27 fix f741433 fix /home/redsun82/ cryptic message directly underneath 10/lib/python3 virtual environment side-effect modules live milestone relationships module moo keyerror root path pip list github diagnostic directories collection python 3 issue 1 pytest
Payment Methods {π}
- Braintree
Questions {β}
- Already have an account?
Schema {πΊοΈ}
DiscussionForumPosting:
context:https://schema.org
headline:`KeyError` fired from `importlib` during collection when running with `--import-mode=importlib` on a directory containing a same-named one
articleBody:<!--
Thanks for submitting an issue!
Quick check-list while reporting bugs:
-->
# A detailed description of the bug or problem you are having
When creating the following structure:
```
x/
ββ y/
β ββ y/
β ββ test_y.py
```
then `pytest --import-mode=importlib` fails with the following cryptic message:
```
================================= ERRORS =================================
_____________________ ERROR collecting x/y/test_y.py _____________________
<frozen importlib._bootstrap_external>:1448: in find_spec
???
<frozen importlib._bootstrap_external>:1222: in __init__
???
<frozen importlib._bootstrap_external>:1238: in _get_parent_path
???
E KeyError: 'x'
```
To trigger this bug:
* the directory containing the test needs to be within at least another directory, it can't be directly underneath the root path
* the directory containing the test must in turn contain another directory with the same base name
Running with `--pdb` gives a slightly more useful backtrace:
```
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/runner.py(341)from_call()
-> result: Optional[TResult] = func()
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/runner.py(389)collect()
-> return list(collector.collect())
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/python.py(548)collect()
-> self._register_setup_module_fixture()
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/python.py(561)_register_setup_module_fixture()
-> self.obj, ("setUpModule", "setup_module")
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/python.py(287)obj()
-> self._obj = obj = self._getobj()
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/python.py(545)_getobj()
-> return importtestmodule(self.path, self.config)
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/python.py(492)importtestmodule()
-> mod = import_path(
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/pathlib.py(565)import_path()
-> mod = _import_module_using_spec(
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/pathlib.py(660)_import_module_using_spec()
-> parent_module = _import_module_using_spec(
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/pathlib.py(633)_import_module_using_spec()
-> spec = meta_importer.find_spec(module_name, [str(module_location)])
<frozen importlib._bootstrap_external>(1448)find_spec()
<frozen importlib._bootstrap_external>(1222)__init__()
> <frozen importlib._bootstrap_external>(1238)_get_parent_path()
```
# Output of `pip list` from the virtual environment you are using
I tried this on a minimal poetry env with just `pytest`
```Package Version
-------------- -------
exceptiongroup 1.2.1
iniconfig 2.0.0
packaging 24.1
pip 24.0
pluggy 1.5.0
pytest 8.2.2
setuptools 70.0.0
tomli 2.0.1
```
# pytest and operating system versions
pytest 8.2.2. Encountered this both with python 3.10 and python 3.12, so the python version doesn't seem to be a factor.
Running on Ubuntu 22.04.4 LTS.
cc @criemen who encountered this
author:
url:https://github.com/redsun82
type:Person
name:redsun82
datePublished:2024-07-10T10:41:44.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:5
url:https://github.com/12592/pytest/issues/12592
context:https://schema.org
headline:`KeyError` fired from `importlib` during collection when running with `--import-mode=importlib` on a directory containing a same-named one
articleBody:<!--
Thanks for submitting an issue!
Quick check-list while reporting bugs:
-->
# A detailed description of the bug or problem you are having
When creating the following structure:
```
x/
ββ y/
β ββ y/
β ββ test_y.py
```
then `pytest --import-mode=importlib` fails with the following cryptic message:
```
================================= ERRORS =================================
_____________________ ERROR collecting x/y/test_y.py _____________________
<frozen importlib._bootstrap_external>:1448: in find_spec
???
<frozen importlib._bootstrap_external>:1222: in __init__
???
<frozen importlib._bootstrap_external>:1238: in _get_parent_path
???
E KeyError: 'x'
```
To trigger this bug:
* the directory containing the test needs to be within at least another directory, it can't be directly underneath the root path
* the directory containing the test must in turn contain another directory with the same base name
Running with `--pdb` gives a slightly more useful backtrace:
```
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/runner.py(341)from_call()
-> result: Optional[TResult] = func()
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/runner.py(389)collect()
-> return list(collector.collect())
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/python.py(548)collect()
-> self._register_setup_module_fixture()
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/python.py(561)_register_setup_module_fixture()
-> self.obj, ("setUpModule", "setup_module")
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/python.py(287)obj()
-> self._obj = obj = self._getobj()
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/python.py(545)_getobj()
-> return importtestmodule(self.path, self.config)
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/python.py(492)importtestmodule()
-> mod = import_path(
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/pathlib.py(565)import_path()
-> mod = _import_module_using_spec(
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/pathlib.py(660)_import_module_using_spec()
-> parent_module = _import_module_using_spec(
/home/redsun82/.cache/pypoetry/virtualenvs/foo-4uHc0o_q-py3.10/lib/python3.10/site-packages/_pytest/pathlib.py(633)_import_module_using_spec()
-> spec = meta_importer.find_spec(module_name, [str(module_location)])
<frozen importlib._bootstrap_external>(1448)find_spec()
<frozen importlib._bootstrap_external>(1222)__init__()
> <frozen importlib._bootstrap_external>(1238)_get_parent_path()
```
# Output of `pip list` from the virtual environment you are using
I tried this on a minimal poetry env with just `pytest`
```Package Version
-------------- -------
exceptiongroup 1.2.1
iniconfig 2.0.0
packaging 24.1
pip 24.0
pluggy 1.5.0
pytest 8.2.2
setuptools 70.0.0
tomli 2.0.1
```
# pytest and operating system versions
pytest 8.2.2. Encountered this both with python 3.10 and python 3.12, so the python version doesn't seem to be a factor.
Running on Ubuntu 22.04.4 LTS.
cc @criemen who encountered this
author:
url:https://github.com/redsun82
type:Person
name:redsun82
datePublished:2024-07-10T10:41:44.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:5
url:https://github.com/12592/pytest/issues/12592
Person:
url:https://github.com/redsun82
name:redsun82
url:https://github.com/redsun82
name:redsun82
InteractionCounter:
interactionType:https://schema.org/CommentAction
userInteractionCount:5
interactionType:https://schema.org/CommentAction
userInteractionCount:5
External Links {π}(2)
Analytics and Tracking {π}
- Site Verification - Google
Libraries {π}
- Bootstrap
- Clipboard.js
- D3.js
- Lodash
Emails and Hosting {βοΈ}
Mail Servers:
- aspmx.l.google.com
- alt1.aspmx.l.google.com
- alt2.aspmx.l.google.com
- alt3.aspmx.l.google.com
- alt4.aspmx.l.google.com
Name Servers:
- dns1.p08.nsone.net
- dns2.p08.nsone.net
- dns3.p08.nsone.net
- dns4.p08.nsone.net
- ns-1283.awsdns-32.org
- ns-1707.awsdns-21.co.uk
- ns-421.awsdns-52.com
- ns-520.awsdns-01.net