Skip to content

Commit 2ce8128

Browse files
committed
fix: update package metadata
Signed-off-by: Frost Ming <me@frostming.com>
1 parent 7895508 commit 2ce8128

File tree

6 files changed

+9
-17
lines changed

6 files changed

+9
-17
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v3
1919
- name: Set up Python ${{ matrix.python-version }}
20-
uses: pdm-project/setup-pdm@main
20+
uses: pdm-project/setup-pdm@v3
2121
with:
2222
python-version: ${{ matrix.python-version }}
23+
cache: true
2324
- name: Install Dependencies
2425
run: |
2526
pdm install -dGtest

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
*.py[cod]
22
__pycache__/
3-
.pdm.toml
3+
.pdm-python
44
dist/
55
build/
66
*.egg-info/

__pypackages__/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ test = [
4040
]
4141

4242
[build-system]
43-
requires = ["pdm-pep517>=0.12.0"]
44-
build-backend = "pdm.pep517.api"
43+
requires = ["pdm-backend"]
44+
build-backend = "pdm.backend"

src/onepm/pip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ class Pip(PackageManager):
99
name = "pip"
1010

1111
def _ensure_virtualenv(self) -> str:
12-
if "VIRTUAL_ENV" in os.environ:
13-
return os.environ["VIRTUAL_ENV"]
1412
this_venv = os.path.abspath(".venv")
1513
if os.path.exists(this_venv) and os.path.exists(
1614
os.path.join(this_venv, "pyvenv.cfg")
1715
):
1816
return this_venv
17+
if "VIRTUAL_ENV" in os.environ:
18+
return os.environ["VIRTUAL_ENV"]
1919

2020
try:
2121
import venv

tests/test_pip.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33

44
import pytest
5-
from onepm import pi, pr, pa, pu, pun
5+
from onepm import pa, pi, pr, pu, pun
66
from onepm.pip import Pip
77

88
pytestmark = pytest.mark.usefixtures("pip")
@@ -13,7 +13,7 @@ def venv(monkeypatch):
1313
monkeypatch.setenv("VIRTUAL_ENV", "foo")
1414

1515

16-
def test_pip_detect_activated_venv(venv):
16+
def test_pip_detect_activated_venv(venv, project):
1717
pm = Pip()
1818
if sys.platform == "win32":
1919
assert pm.command == ["foo\\Scripts\\python.exe", "-m", "pip"]
@@ -39,13 +39,6 @@ def test_pip_detect_dot_venv(project):
3939
]
4040

4141

42-
def test_pip_no_venv_error(project):
43-
with pytest.raises(
44-
Exception, match="To use pip, you must activate a virtualenv or create one"
45-
):
46-
pi([])
47-
48-
4942
def test_install_without_args_error(project, venv):
5043
with pytest.raises(
5144
Exception, match="No requirements.txt or setup.py/pyproject.toml is found"

0 commit comments

Comments
 (0)