Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
def1ee8f
Unverified
Commit
def1ee8f
authored
Nov 06, 2022
by
finswimmer
Committed by
GitHub
Nov 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: fixed an issue where in-project venv wasn't listed
parent
b1e1e14c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
1 deletions
+43
-1
src/poetry/utils/env.py
+1
-1
tests/console/commands/env/conftest.py
+26
-0
tests/console/commands/env/test_list.py
+16
-0
No files found.
src/poetry/utils/env.py
View file @
def1ee8f
...
@@ -734,7 +734,7 @@ class EnvManager:
...
@@ -734,7 +734,7 @@ class EnvManager:
venv
=
self
.
_poetry
.
file
.
parent
/
".venv"
venv
=
self
.
_poetry
.
file
.
parent
/
".venv"
if
(
if
(
self
.
_poetry
.
config
.
get
(
"virtualenvs.in-project"
)
self
.
_poetry
.
config
.
get
(
"virtualenvs.in-project"
)
is
not
False
and
venv
.
exists
()
and
venv
.
exists
()
and
venv
.
is_dir
()
and
venv
.
is_dir
()
):
):
...
...
tests/console/commands/env/conftest.py
View file @
def1ee8f
...
@@ -66,3 +66,29 @@ def venvs_in_project_dir(app: PoetryTestApplication) -> Iterator[Path]:
...
@@ -66,3 +66,29 @@ def venvs_in_project_dir(app: PoetryTestApplication) -> Iterator[Path]:
yield
venv_dir
yield
venv_dir
finally
:
finally
:
venv_dir
.
rmdir
()
venv_dir
.
rmdir
()
@pytest.fixture
def
venvs_in_project_dir_none
(
app
:
PoetryTestApplication
)
->
Iterator
[
Path
]:
os
.
environ
.
pop
(
"VIRTUAL_ENV"
,
None
)
venv_dir
=
app
.
poetry
.
file
.
parent
.
joinpath
(
".venv"
)
venv_dir
.
mkdir
(
exist_ok
=
True
)
app
.
poetry
.
config
.
merge
({
"virtualenvs"
:
{
"in-project"
:
None
}})
try
:
yield
venv_dir
finally
:
venv_dir
.
rmdir
()
@pytest.fixture
def
venvs_in_project_dir_false
(
app
:
PoetryTestApplication
)
->
Iterator
[
Path
]:
os
.
environ
.
pop
(
"VIRTUAL_ENV"
,
None
)
venv_dir
=
app
.
poetry
.
file
.
parent
.
joinpath
(
".venv"
)
venv_dir
.
mkdir
(
exist_ok
=
True
)
app
.
poetry
.
config
.
merge
({
"virtualenvs"
:
{
"in-project"
:
False
}})
try
:
yield
venv_dir
finally
:
venv_dir
.
rmdir
()
tests/console/commands/env/test_list.py
View file @
def1ee8f
...
@@ -60,3 +60,19 @@ def test_in_project_venv(tester: CommandTester, venvs_in_project_dir: list[str])
...
@@ -60,3 +60,19 @@ def test_in_project_venv(tester: CommandTester, venvs_in_project_dir: list[str])
tester
.
execute
()
tester
.
execute
()
expected
=
".venv (Activated)
\n
"
expected
=
".venv (Activated)
\n
"
assert
tester
.
io
.
fetch_output
()
==
expected
assert
tester
.
io
.
fetch_output
()
==
expected
def
test_in_project_venv_no_explicit_config
(
tester
:
CommandTester
,
venvs_in_project_dir_none
:
list
[
str
]
):
tester
.
execute
()
expected
=
".venv (Activated)
\n
"
assert
tester
.
io
.
fetch_output
()
==
expected
def
test_in_project_venv_is_false
(
tester
:
CommandTester
,
venvs_in_project_dir_false
:
list
[
str
]
):
tester
.
execute
()
expected
=
""
assert
tester
.
io
.
fetch_output
()
==
expected
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment