From 2ecd5d1300ee8685f742af7fa595ab44d7329f94 Mon Sep 17 00:00:00 2001 From: frostming Date: Wed, 29 Apr 2020 20:01:36 +0800 Subject: [PATCH 1/3] fix toml table construction --- pipenv/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipenv/project.py b/pipenv/project.py index 4cb2ff9c..ee2219ef 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -790,7 +790,7 @@ class Project(object): except Exception: document = tomlkit.document() for section in ("packages", "dev-packages"): - document[section] = tomlkit.container.Table() + document[section] = tomlkit.table() # Convert things to inline tables — fancy :) for package in data.get(section, {}): if hasattr(data[section][package], "keys"): From 8162a22bca8084eb5993a6c7555cec7c1c4548f8 Mon Sep 17 00:00:00 2001 From: frostming Date: Thu, 30 Apr 2020 09:49:13 +0800 Subject: [PATCH 2/3] add a test case --- tests/integration/test_install_basic.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/integration/test_install_basic.py b/tests/integration/test_install_basic.py index 9d3247fe..b398561c 100644 --- a/tests/integration/test_install_basic.py +++ b/tests/integration/test_install_basic.py @@ -280,14 +280,13 @@ def test_bad_packages(PipenvInstance): @pytest.mark.extras @pytest.mark.install @pytest.mark.requirements -@pytest.mark.skip(reason="Not mocking this.") -def test_requirements_to_pipfile(PipenvInstance): +def test_requirements_to_pipfile(PipenvInstance, pypi): with PipenvInstance(pipfile=False, chdir=True) as p: # Write a requirements file with open("requirements.txt", "w") as f: - f.write("requests[socks]==2.18.1\n") + f.write("-i {}\nrequests[socks]==2.18.1\n".format(pypi.url)) c = p.pipenv("install") assert c.return_code == 0 From a77e329341bc18b91a791d7813713caec4a36dfc Mon Sep 17 00:00:00 2001 From: frostming Date: Thu, 30 Apr 2020 10:45:43 +0800 Subject: [PATCH 3/3] Use the version in mocked PyPI --- tests/integration/test_install_basic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/test_install_basic.py b/tests/integration/test_install_basic.py index b398561c..97f336e0 100644 --- a/tests/integration/test_install_basic.py +++ b/tests/integration/test_install_basic.py @@ -286,7 +286,7 @@ def test_requirements_to_pipfile(PipenvInstance, pypi): # Write a requirements file with open("requirements.txt", "w") as f: - f.write("-i {}\nrequests[socks]==2.18.1\n".format(pypi.url)) + f.write("-i {}\nrequests[socks]==2.19.1\n".format(pypi.url)) c = p.pipenv("install") assert c.return_code == 0