From 794786bcedb87f61236309f09a492874217ef6c3 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Thu, 22 Mar 2018 14:16:22 +0800 Subject: [PATCH 1/3] Add requests's pem file to distribution Maybe fix #1800? --- MANIFEST.in | 1 + 1 file changed, 1 insertion(+) diff --git a/MANIFEST.in b/MANIFEST.in index dcbdb085..e206fd3f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,4 +3,5 @@ include pipenv/patched/notpip/_vendor/requests/cacert.pem include pipenv/vendor/pip9/_vendor/requests/cacert.pem include pipenv/vendor/pipreqs/stdlib include pipenv/vendor/pipreqs/mapping +include pipenv/vendor/requests/cacert.pem include pipenv/pipenv.1 From e51b5d09965b7ae8ea67a0fe280fe4db48ca832d Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Thu, 22 Mar 2018 19:53:01 +0800 Subject: [PATCH 2/3] Add tests for environment marker precedence logic Close #1757. --- tests/test_pipenv.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/tests/test_pipenv.py b/tests/test_pipenv.py index 3d463bd0..3a80e30e 100644 --- a/tests/test_pipenv.py +++ b/tests/test_pipenv.py @@ -602,6 +602,49 @@ requests = {version = "*", os_name = "== 'splashwear'"} c = p.pipenv('run python -c "import requests;"') assert c.return_code == 1 + @pytest.mark.markers + @pytest.mark.install + def test_top_level_overrides_environment_markers(self): + """Top-level environment markers should take precedence. + """ + with PipenvInstance() as p: + with open(p.pipfile_path, 'w') as f: + contents = """ +[packages] +apscheduler = "*" +funcsigs = {version = "*", os_name = "== 'splashwear'"} + """.strip() + f.write(contents) + + c = p.pipenv('install') + assert c.return_code == 0 + + assert p.lockfile['default']['funcsigs']['markers'] == "os_name == 'splashwear'" + + @pytest.mark.markers + @pytest.mark.install + def test_global_overrides_environment_markers(self): + """Empty (unconditional) dependency should take precedence. + + If a dependency is specified without environment markers, it should + override dependencies with environment markers. In this example, + APScheduler requires funcsigs only on Python 2, but since funcsigs is + also specified as an unconditional dep, its markers should be empty. + """ + with PipenvInstance() as p: + with open(p.pipfile_path, 'w') as f: + contents = """ +[packages] +apscheduler = "*" +funcsigs = "*" + """.strip() + f.write(contents) + + c = p.pipenv('install') + assert c.return_code == 0 + + assert p.lockfile['default']['funcsigs'].get('markers', '') == '' + @pytest.mark.install @pytest.mark.vcs @pytest.mark.tablib From 306714c053f1fb646c43aadb98113c881957f7e5 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Fri, 23 Mar 2018 01:59:55 +0800 Subject: [PATCH 3/3] Need to test markers --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0aeec864..31aea924 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ python: env: - TEST_SUITE='dotvenv or check or unused or requirements' - TEST_SUITE='complex' - - TEST_SUITE='run or project or utils' + - TEST_SUITE='markers or run or project or utils' # command to install dependencies install: @@ -31,4 +31,4 @@ stages: - integration - test - name: takes-forever - if: branch = master \ No newline at end of file + if: branch = master