[arch-commits] Commit in python-cmd2/trunk (PKGBUILD fix-test.patch)
Felix Yan
felixonmars at archlinux.org
Sat Aug 12 06:44:18 UTC 2017
Date: Saturday, August 12, 2017 @ 06:44:17
Author: felixonmars
Revision: 249946
upgpkg: python-cmd2 0.7.6-1
Modified:
python-cmd2/trunk/PKGBUILD
Deleted:
python-cmd2/trunk/fix-test.patch
----------------+
PKGBUILD | 13 ++-----
fix-test.patch | 102 -------------------------------------------------------
2 files changed, 5 insertions(+), 110 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2017-08-12 06:01:01 UTC (rev 249945)
+++ PKGBUILD 2017-08-12 06:44:17 UTC (rev 249946)
@@ -4,7 +4,7 @@
pkgbase=python-cmd2
pkgname=(python-cmd2 python2-cmd2)
-pkgver=0.7.5
+pkgver=0.7.6
pkgrel=1
pkgdesc="Extra features for standard library's cmd module"
arch=('any')
@@ -11,15 +11,12 @@
url="https://github.com/python-cmd2/cmd2"
license=('MIT')
makedepends=('python-setuptools' 'python2-setuptools' 'python-pyparsing' 'python2-pyparsing'
- 'python-pyperclip' 'python2-pyperclip')
+ 'python-pyperclip' 'python2-pyperclip' 'python2-subprocess32')
checkdepends=('python-pytest-runner' 'python2-pytest-runner' 'python-mock' 'python2-mock' 'vi')
-source=("$pkgbase-$pkgver.tar.gz::https://github.com/python-cmd2/cmd2/archive/$pkgver.tar.gz"
- fix-test.patch)
-sha512sums=('27f8d4076d6abcafef5e7a79049ab281e4bd76fa22ee83ea0c390af646cd8af03d93b4a05ab27eddb3974955fe5eb4f3fbff531b8903e2fa49fbd7d370603da9'
- '4d9b2bd0125540935353d88d29ea5ffa78065cdf45d8f35b38ddf3eedd8c6193d518813aeccddb9261344c49b79fcdada39cb4de2f439a5e5faa2134147bd928')
+source=("$pkgbase-$pkgver.tar.gz::https://github.com/python-cmd2/cmd2/archive/$pkgver.tar.gz")
+sha512sums=('05e988deb762725d17ce7b109e2b5d9d6f0b9f40af57fe428e75529c9d1f171d2677f2ab3586e418b20184e06bb5adab1dc93ec40f35014917d5871e6d88cdde')
prepare() {
- (cd cmd2-$pkgver; patch -p1 -i ../fix-test.patch)
cp -a cmd2-$pkgver{,-py2}
}
@@ -47,7 +44,7 @@
}
package_python2-cmd2() {
- depends=('python2-pyparsing' 'python2-pyperclip')
+ depends=('python2-pyparsing' 'python2-pyperclip' 'python2-subprocess32')
cd "$srcdir"/cmd2-$pkgver-py2
python2 setup.py install --root="$pkgdir" --optimize=1
Deleted: fix-test.patch
===================================================================
--- fix-test.patch 2017-08-12 06:01:01 UTC (rev 249945)
+++ fix-test.patch 2017-08-12 06:44:17 UTC (rev 249946)
@@ -1,102 +0,0 @@
-commit 87e04d73046e910b639aaec462b4b77a1735f404
-Author: Felix Yan <felixonmars at archlinux.org>
-Date: Mon Jul 10 00:29:42 2017 +0800
-
- Use monkeypatch to ensure os.system is restored
-
- Without this patch, running tests like test_edit_number before
- test_default_to_shell_good in the same process will trigger
- this error:
-
- ```
- _______________________________________________________________ test_default_to_shell_good ________________________________________________________________
-
- capsys = <_pytest.capture.CaptureFixture object at 0x7f7e90103898>
-
- def test_default_to_shell_good(capsys):
- app = cmd2.Cmd()
- app.default_to_shell = True
- line = 'ls'
- statement = app.parser_manager.parsed(line)
- retval = app._default(statement)
- assert not retval
- out, err = capsys.readouterr()
- > assert out == ''
- E AssertionError: assert '*** Unknown syntax: ls \n' == ''
- E - *** Unknown syntax: ls
-
- tests/test_cmd2.py:840: AssertionError
- ```
-
- Using monkeypatch fixture to restore os.system fixes the problem here.
-
-diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
-index 1deff47..0e25529 100644
---- a/tests/test_cmd2.py
-+++ b/tests/test_cmd2.py
-@@ -661,13 +661,13 @@ def test_edit_no_editor(base_app, capsys):
- expected = _expected_no_editor_error()
- assert normalize(str(err)) == expected
-
--def test_edit_file(base_app, request):
-+def test_edit_file(base_app, request, monkeypatch):
- # Set a fake editor just to make sure we have one. We aren't really going to call it due to the mock
- base_app.editor = 'fooedit'
-
- # Mock out the os.system call so we don't actually open an editor
- m = mock.MagicMock(name='system')
-- os.system = m
-+ monkeypatch.setattr("os.system", m)
-
- test_dir = os.path.dirname(request.module.__file__)
- filename = os.path.join(test_dir, 'script.txt')
-@@ -677,13 +677,13 @@ def test_edit_file(base_app, request):
- # We think we have an editor, so should expect a system call
- m.assert_called_once_with('{} {}'.format(base_app.editor, filename))
-
--def test_edit_number(base_app):
-+def test_edit_number(base_app, monkeypatch):
- # Set a fake editor just to make sure we have one. We aren't really going to call it due to the mock
- base_app.editor = 'fooedit'
-
- # Mock out the os.system call so we don't actually open an editor
- m = mock.MagicMock(name='system')
-- os.system = m
-+ monkeypatch.setattr("os.system", m)
-
- # Run help command just so we have a command in history
- run_cmd(base_app, 'help')
-@@ -693,13 +693,13 @@ def test_edit_number(base_app):
- # We have an editor, so should expect a system call
- m.assert_called_once()
-
--def test_edit_blank(base_app):
-+def test_edit_blank(base_app, monkeypatch):
- # Set a fake editor just to make sure we have one. We aren't really going to call it due to the mock
- base_app.editor = 'fooedit'
-
- # Mock out the os.system call so we don't actually open an editor
- m = mock.MagicMock(name='system')
-- os.system = m
-+ monkeypatch.setattr("os.system", m)
-
- # Run help command just so we have a command in history
- run_cmd(base_app, 'help')
-@@ -1222,7 +1222,7 @@ def abbrev_app():
- app.stdout = StdOut()
- return app
-
--def test_exclude_from_history(abbrev_app):
-+def test_exclude_from_history(abbrev_app, monkeypatch):
- # Run all variants of run
- run_cmd(abbrev_app, 'run')
- run_cmd(abbrev_app, 'ru')
-@@ -1230,7 +1230,7 @@ def test_exclude_from_history(abbrev_app):
-
- # Mock out the os.system call so we don't actually open an editor
- m = mock.MagicMock(name='system')
-- os.system = m
-+ monkeypatch.setattr("os.system", m)
-
- # Run all variants of edit
- run_cmd(abbrev_app, 'edit')
More information about the arch-commits
mailing list