Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IN_VIRTUAL_ENV #47

Merged
merged 1 commit into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions microvenv/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
import sys

# Exported as part of the public API.
from ._create import create as create

# https://docs.python.org/3/library/venv.html#how-venvs-work
IN_VIRTUAL_ENV = sys.prefix != sys.base_prefix

7 changes: 7 additions & 0 deletions tests/test_in_virtual_env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import sys

import microvenv


def test_in_virtual_env():
assert microvenv.IN_VIRTUAL_ENV == (sys.prefix != sys.base_prefix)