From 5eb4d832d05a02596f07afc58e3ae086eb173e41 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Fri, 22 Feb 2019 13:10:03 +0100 Subject: [PATCH 1/8] cherry-picker: Run Travis CI test on Windows Fixes: https://github.com/python/core-workflow/issues/296 --- .travis.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3e9938a..20d0b68 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,8 @@ sudo: false cache: pip before_install: -- pip install --upgrade flit +- &install-flit + pip install --upgrade flit .mixtures: - &run-if-tagged @@ -99,6 +100,16 @@ jobs: env: TARGET_PKG: cherry_picker + - os: windows + language: sh + python: 3.7 + before_install: + - choco install python --version 3.7 + - export PATH="/c/Python37:/c/Python37/Scripts:$PATH" + - python -m pip install --upgrade pip wheel + - *install-flit + <<: *install-and-test-cherry-picker + - <<: *deploy-base <<: *run-if-blurb if: 1 != 1 From c9a3c8be35470cbf204d38745d86830ccbef2aae Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 15 Mar 2019 19:31:16 +0100 Subject: [PATCH 2/8] Use explicit block literal in before_install in Travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 20d0b68..dee36c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ sudo: false cache: pip before_install: -- &install-flit +- &install-flit >- pip install --upgrade flit .mixtures: From 3cefad1140048bb65eec8573b0e56223e2cae8a8 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 15 Mar 2019 19:32:47 +0100 Subject: [PATCH 3/8] Use declarative way of setting up env vars --- .travis.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dee36c1..8da56be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -105,10 +105,13 @@ jobs: python: 3.7 before_install: - choco install python --version 3.7 - - export PATH="/c/Python37:/c/Python37/Scripts:$PATH" - python -m pip install --upgrade pip wheel - *install-flit <<: *install-and-test-cherry-picker + env: + PATH: >- + /c/Python37:/c/Python37/Scripts:$PATH + TARGET_PKG: cherry_picker - <<: *deploy-base <<: *run-if-blurb From bcb89e3fe8e0aada58c20b000ecca4d63a1f6c94 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 15 Mar 2019 19:41:54 +0100 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=90=9B=E2=9C=85=20Set=20up=20Git=20us?= =?UTF-8?q?er=20name=20and=20email=20in=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cherry_picker/cherry_picker/test.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cherry_picker/cherry_picker/test.py b/cherry_picker/cherry_picker/test.py index 18a2198..6cb643f 100644 --- a/cherry_picker/cherry_picker/test.py +++ b/cherry_picker/cherry_picker/test.py @@ -84,9 +84,19 @@ def git_cherry_pick(): @pytest.fixture -def tmp_git_repo_dir(tmpdir, cd, git_init, git_commit): +def git_config(): + git_config_cmd = 'git', 'config' + return lambda *extra_args: ( + subprocess.run(git_config_cmd + extra_args, check=True) + ) + + +@pytest.fixture +def tmp_git_repo_dir(tmpdir, cd, git_init, git_commit, git_config): cd(tmpdir) git_init() + git_config('--local', 'user.name', 'Monty Python') + git_config('--local', 'user.email', 'bot@python.org') git_commit('Initial commit', '--allow-empty') yield tmpdir From ae151c623b71d7ad98d27bde045c04805b58a82e Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 15 Mar 2019 19:59:06 +0100 Subject: [PATCH 5/8] =?UTF-8?q?=E2=9C=85=F0=9F=8E=A8=20Use=20fixtures=20in?= =?UTF-8?q?=20find=20config=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cherry_picker/cherry_picker/test.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/cherry_picker/cherry_picker/test.py b/cherry_picker/cherry_picker/test.py index 6cb643f..c4b9776 100644 --- a/cherry_picker/cherry_picker/test.py +++ b/cherry_picker/cherry_picker/test.py @@ -268,22 +268,16 @@ def test_is_not_cpython_repo(): ["3.6"]) -def test_find_config(tmpdir, cd): - cd(tmpdir) - subprocess.run('git init .'.split(), check=True) +def test_find_config(tmp_git_repo_dir, git_add, git_commit): relative_config_path = '.cherry_picker.toml' - cfg = tmpdir.join(relative_config_path) - cfg.write('param = 1') - subprocess.run('git add .'.split(), check=True) - subprocess.run(('git', 'commit', '-m', 'Initial commit'), check=True) + tmp_git_repo_dir.join(relative_config_path).write('param = 1') + git_add(relative_config_path) + git_commit('Add config') scm_revision = get_sha1_from('HEAD') - assert find_config(scm_revision) == scm_revision + ':' + relative_config_path + assert find_config(scm_revision) == f'{scm_revision}:{relative_config_path}' -def test_find_config_not_found(tmpdir, cd): - cd(tmpdir) - subprocess.run('git init .'.split(), check=True) - subprocess.run(('git', 'commit', '-m', 'Initial commit', '--allow-empty'), check=True) +def test_find_config_not_found(tmp_git_repo_dir): scm_revision = get_sha1_from('HEAD') assert find_config(scm_revision) is None From 0263b576138623000f4766336ca9504717fb10bd Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 15 Mar 2019 20:05:41 +0100 Subject: [PATCH 6/8] =?UTF-8?q?=E2=9C=85=F0=9F=8E=A8=20Use=20fixtures=20in?= =?UTF-8?q?=20load=20config=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cherry_picker/cherry_picker/test.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/cherry_picker/cherry_picker/test.py b/cherry_picker/cherry_picker/test.py index c4b9776..176bb86 100644 --- a/cherry_picker/cherry_picker/test.py +++ b/cherry_picker/cherry_picker/test.py @@ -287,19 +287,16 @@ def test_find_config_not_git(tmpdir, cd): assert find_config(None) is None -def test_load_full_config(tmpdir, cd): - cd(tmpdir) - subprocess.run('git init .'.split(), check=True) +def test_load_full_config(tmp_git_repo_dir, git_add, git_commit): relative_config_path = '.cherry_picker.toml' - cfg = tmpdir.join(relative_config_path) - cfg.write('''\ + tmp_git_repo_dir.join(relative_config_path).write('''\ team = "python" repo = "core-workfolow" check_sha = "5f007046b5d4766f971272a0cc99f8461215c1ec" default_branch = "devel" ''') - subprocess.run('git add .'.split(), check=True) - subprocess.run(('git', 'commit', '-m', 'Initial commit'), check=True) + git_add(relative_config_path) + git_commit('Add config') scm_revision = get_sha1_from('HEAD') cfg = load_config(None) assert cfg == ( @@ -314,16 +311,13 @@ def test_load_full_config(tmpdir, cd): ) -def test_load_partial_config(tmpdir, cd): - cd(tmpdir) - subprocess.run('git init .'.split(), check=True) +def test_load_partial_config(tmp_git_repo_dir, git_add, git_commit): relative_config_path = '.cherry_picker.toml' - cfg = tmpdir.join(relative_config_path) - cfg.write('''\ + tmp_git_repo_dir.join(relative_config_path).write('''\ repo = "core-workfolow" ''') - subprocess.run('git add .'.split(), check=True) - subprocess.run(('git', 'commit', '-m', 'Initial commit'), check=True) + git_add(relative_config_path) + git_commit('Add config') scm_revision = get_sha1_from('HEAD') cfg = load_config(relative_config_path) assert cfg == ( From 683c3a83f767de37d0e074f994378f2d81f779d8 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 15 Mar 2019 20:17:19 +0100 Subject: [PATCH 7/8] =?UTF-8?q?=F0=9F=9A=91Use=20pathlib's=20write=5Ftext?= =?UTF-8?q?=20for=20saving=20test=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cherry_picker/cherry_picker/test.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cherry_picker/cherry_picker/test.py b/cherry_picker/cherry_picker/test.py index 176bb86..6de7d45 100644 --- a/cherry_picker/cherry_picker/test.py +++ b/cherry_picker/cherry_picker/test.py @@ -415,7 +415,9 @@ def test_from_git_rev_read_negative( def test_from_git_rev_read_uncommitted(tmp_git_repo_dir, git_add, git_commit): some_text = 'blah blah 🤖' relative_file_path = '.some.file' - tmp_git_repo_dir.join(relative_file_path).write(some_text) + ( + pathlib.Path(tmp_git_repo_dir) / relative_file_path + ).write_text(some_text) git_add('.') with pytest.raises(ValueError): from_git_rev_read('HEAD:' + relative_file_path) == some_text @@ -424,7 +426,9 @@ def test_from_git_rev_read_uncommitted(tmp_git_repo_dir, git_add, git_commit): def test_from_git_rev_read(tmp_git_repo_dir, git_add, git_commit): some_text = 'blah blah 🤖' relative_file_path = '.some.file' - tmp_git_repo_dir.join(relative_file_path).write(some_text) + ( + pathlib.Path(tmp_git_repo_dir) / relative_file_path + ).write_text(some_text) git_add('.') git_commit('Add some file') assert from_git_rev_read('HEAD:' + relative_file_path) == some_text From e7c0d2b659f3c7c8e8bf8fc390f946cb7a9ac019 Mon Sep 17 00:00:00 2001 From: Sviatoslav Sydorenko Date: Fri, 15 Mar 2019 21:12:58 +0100 Subject: [PATCH 8/8] =?UTF-8?q?=F0=9F=9A=91=20Use=20UTF-8=20encoding=20for?= =?UTF-8?q?=20saving=20test=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cherry_picker/cherry_picker/test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cherry_picker/cherry_picker/test.py b/cherry_picker/cherry_picker/test.py index 6de7d45..cc79670 100644 --- a/cherry_picker/cherry_picker/test.py +++ b/cherry_picker/cherry_picker/test.py @@ -417,7 +417,7 @@ def test_from_git_rev_read_uncommitted(tmp_git_repo_dir, git_add, git_commit): relative_file_path = '.some.file' ( pathlib.Path(tmp_git_repo_dir) / relative_file_path - ).write_text(some_text) + ).write_text(some_text, encoding='utf-8') git_add('.') with pytest.raises(ValueError): from_git_rev_read('HEAD:' + relative_file_path) == some_text @@ -428,7 +428,7 @@ def test_from_git_rev_read(tmp_git_repo_dir, git_add, git_commit): relative_file_path = '.some.file' ( pathlib.Path(tmp_git_repo_dir) / relative_file_path - ).write_text(some_text) + ).write_text(some_text, encoding='utf-8') git_add('.') git_commit('Add some file') assert from_git_rev_read('HEAD:' + relative_file_path) == some_text pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy