Hello community,
here is the log from the commit of package python-plumbum for openSUSE:Leap:15.2 checked in at 2020-04-30 18:52:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Leap:15.2/python-plumbum (Old)
and /work/SRC/openSUSE:Leap:15.2/.python-plumbum.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-plumbum"
Thu Apr 30 18:52:25 2020 rev:6 rq:798412 version:1.6.9
Changes:
--------
--- /work/SRC/openSUSE:Leap:15.2/python-plumbum/python-plumbum.changes 2020-03-23 07:13:54.354498979 +0100
+++ /work/SRC/openSUSE:Leap:15.2/.python-plumbum.new.2738/python-plumbum.changes 2020-04-30 18:52:26.180724690 +0200
@@ -1,0 +2,13 @@
+Mon Apr 27 07:26:40 UTC 2020 - Tomáš Chvátal
+
+- Add patch fixing build with no python2 available:
+ * no-python2.patch
+- Update to 1.6.9:
+ * Last version to support Python 2.6; added python_requires (#507)
+ * Paths: Fix bug with subscription operations (#498), (#506)
+ * Paths: Fix resolve (#492)
+ * Commands: Fix resolve (#491)
+ * Commands: Add context manager on popen (#495)
+ * Several smaller fixes (#500), (#505)
+
+-------------------------------------------------------------------
Old:
----
v1.6.8.tar.gz
New:
----
no-python2.patch
v1.6.9.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-plumbum.spec ++++++
--- /var/tmp/diff_new_pack.Jg6Ax5/_old 2020-04-30 18:52:26.548725467 +0200
+++ /var/tmp/diff_new_pack.Jg6Ax5/_new 2020-04-30 18:52:26.552725475 +0200
@@ -18,13 +18,13 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-plumbum
-Version: 1.6.8
+Version: 1.6.9
Release: 0
Summary: Shell combinators library
License: MIT
-Group: Development/Languages/Python
URL: https://github.com/tomerfiliba/plumbum
Source: https://github.com/tomerfiliba/plumbum/archive/v%{version}.tar.gz
+Patch0: no-python2.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -51,6 +51,7 @@
%prep
%setup -q -n plumbum-%{version}
+%patch0 -p1
# remote tests won't work in OBS
rm tests/test_remote.py
++++++ no-python2.patch ++++++
Index: plumbum-1.6.9/tests/test_local.py
===================================================================
--- plumbum-1.6.9.orig/tests/test_local.py
+++ plumbum-1.6.9/tests/test_local.py
@@ -966,7 +966,7 @@ class TestLocalEncoding:
name = self.richstr + six.str("_program")
with open(name, 'w') as f:
- f.write("#!/usr/bin/env python\nprint('yes')")
+ f.write("#!{}\nprint('yes')".format(sys.executable))
st = os.stat(name)
os.chmod(name, st.st_mode | stat.S_IEXEC)
++++++ v1.6.8.tar.gz -> v1.6.9.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/.ci/travis.sh new/plumbum-1.6.9/.ci/travis.sh
--- old/plumbum-1.6.8/.ci/travis.sh 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/.ci/travis.sh 2020-03-23 14:25:44.000000000 +0100
@@ -11,7 +11,7 @@
else
pip install --upgrade pip
pip install -r dev-requirements.txt
- pip install coveralls
+ pip install 'coveralls;python_version>="2.7"'
pip install -e .
fi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/.travis.yml new/plumbum-1.6.9/.travis.yml
--- old/plumbum-1.6.8/.travis.yml 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/.travis.yml 2020-03-23 14:25:44.000000000 +0100
@@ -13,10 +13,12 @@
env: PYV=3.6
- python: 3.7
env: PYV=3.7
+ - python: 3.8
+ env: PYV=3.8
- python: 2.6
dist: trusty
env: PYV=2.6
- - python: pypy
+ - python: pypy3
- language: generic
env: PY3=2 PYV=Mac2
os: osx
@@ -32,7 +34,7 @@
install: ".ci/travis.sh"
script: python$PY3 setup.py test -c
after_success:
-- if [ -n "$PYV" ] ; then coveralls; fi
+- if [ -n "$PYV" ] && [ "$PYV" -ne "2.6" ] ; then coveralls; fi
notifications:
email:
on_success: change
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/CHANGELOG.rst new/plumbum-1.6.9/CHANGELOG.rst
--- old/plumbum-1.6.8/CHANGELOG.rst 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/CHANGELOG.rst 2020-03-23 14:25:44.000000000 +0100
@@ -1,3 +1,14 @@
+1.6.9
+-----
+
+* Last version to support Python 2.6; added python_requires (`#507 https://github.com/tomerfiliba/plumbum/pull/507`_)
+* Paths: Fix bug with subscription operations (`#498 https://github.com/tomerfiliba/plumbum/pull/498`_), (`#506 https://github.com/tomerfiliba/plumbum/pull/506`_)
+* Paths: Fix resolve (`#492 https://github.com/tomerfiliba/plumbum/pull/492`_)
+* Commands: Fix resolve (`#491 https://github.com/tomerfiliba/plumbum/pull/491`_)
+* Commands: Add context manager on popen (`#495 https://github.com/tomerfiliba/plumbum/pull/495`_)
+* Several smaller fixes (`#500 https://github.com/tomerfiliba/plumbum/pull/500`_), (`#505 https://github.com/tomerfiliba/plumbum/pull/505`_)
+
+
1.6.8
-----
* Exceptions: Changed ProcessExecutionError's formatting to be more user-friendly (`#456 https://github.com/tomerfiliba/plumbum/pull/456`_)
@@ -5,7 +16,7 @@
* Commands: support for piping stdout/stderr to a logger (`#454 https://github.com/tomerfiliba/plumbum/pull/454`_)
* Paths: support composing paths using subscription operations (`#455 https://github.com/tomerfiliba/plumbum/pull/455`_)
* CLI: Improved 'Set' validator to allow non-string types, and CSV params (`#452 https://github.com/tomerfiliba/plumbum/pull/452`_)
-* TypedEnv: Facility for modeling environment-variables into python data types (`#451 https://github.com/tomerfiliba/plumbum/pull/450`_)
+* TypedEnv: Facility for modeling environment-variables into python data types (`#451 https://github.com/tomerfiliba/plumbum/pull/451`_)
* Commands: execute local/remote commands via a magic `.cmd` attribute (`#450 https://github.com/tomerfiliba/plumbum/pull/450`_)
1.6.7
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/README.rst new/plumbum-1.6.9/README.rst
--- old/plumbum-1.6.8/README.rst 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/README.rst 2020-03-23 14:25:44.000000000 +0100
@@ -16,9 +16,9 @@
.. image:: https://img.shields.io/pypi/pyversions/plumbum.svg
:target: https://pypi.python.org/pypi/plumbum/
:alt: PyPI Versions
-.. image:: https://anaconda.org/conda-forge/plumbum/badges/version.svg
- :target: https://anaconda.org/conda-forge/plumbum
- :alt: Anaconda-Server Badge
+.. image:: https://img.shields.io/conda/vn/conda-forge/plumbum.svg
+ :target: https://github.com/conda-forge/plumbum-feedstock
+ :alt: Conda-Forge Badge
.. image:: https://img.shields.io/pypi/l/plumbum.svg
:target: https://pypi.python.org/pypi/plumbum/
:alt: PyPI License
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/docs/index.rst new/plumbum-1.6.9/docs/index.rst
--- old/plumbum-1.6.8/docs/index.rst 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/docs/index.rst 2020-03-23 14:25:44.000000000 +0100
@@ -118,6 +118,7 @@
remote
utils
cli
+ typed_env
colors
changelog
quickref
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/docs/typed_env.rst new/plumbum-1.6.9/docs/typed_env.rst
--- old/plumbum-1.6.8/docs/typed_env.rst 1970-01-01 01:00:00.000000000 +0100
+++ new/plumbum-1.6.9/docs/typed_env.rst 2020-03-23 14:25:44.000000000 +0100
@@ -0,0 +1,96 @@
+.. _guide-typed-env:
+
+TypedEnv
+========
+Plumbum provides this utility class to facilitate working with environment variables.
+Similar to how :class:`plumbum.cli.Application` parses command line arguments into pythonic data types,
+:class:`plumbum.typed_env.TypedEnv` parses environment variables:
+
+class MyEnv(TypedEnv):
+ username = TypedEnv.Str("USER", default='anonymous')
+ path = TypedEnv.CSV("PATH", separator=":", type=local.path)
+ tmp = TypedEnv.Str(["TMP", "TEMP"]) # support 'fallback' var-names
+ is_travis = TypedEnv.Bool("TRAVIS", default=False) # True is 'yes/true/1' (case-insensitive)
+
+We can now instantiate this class to access its attributes::
+
+ >>> env = MyEnv()
+ >>> env.username
+ 'ofer'
+
+ >>> env.path
+ [,
+ ,
+ ,
+ ,
+ ,
+ ,
+ ]
+
+ >>> env.tmp
+ Traceback (most recent call last):
+ [...]
+ KeyError: 'TMP'
+
+ >>> env.is_travis
+ False
+
+Finally, our ``TypedEnv`` object allows us ad-hoc access to the rest of the environment variables, using dot-notation::
+
+ >>> env.HOME
+ '/home/ofer'
+
+We can also update the environment via our ``TypedEnv`` object:
+
+ >>> env.tmp = "/tmp"
+ >>> env.tmp
+ '/tmp'
+
+ >>> from os import environ
+ >>> env.TMP
+ '/tmp'
+
+ >>> env.is_travis = True
+ >>> env.TRAVIS
+ 'yes'
+
+ >>> env.path = [local.path("/a"), local.path("/b")]
+ >>> env.PATH
+ '/a:/b'
+
+
+TypedEnv as an Abstraction Layer
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+The ``TypedEnv`` class is very useful for separating your application from the actual environment variables.
+It provides a layer where parsing and normalizing can take place in a centralized fashion.
+
+For example, you might start with this simple implementation::
+
+ class CiBuildEnv(TypedEnv):
+ job_id = TypedEnv.Str("BUILD_ID")
+
+
+Later, as the application gets more complicated, you may expand your implementation like so::
+
+ class CiBuildEnv(TypedEnv):
+ is_travis = TypedEnv.Bool("TRAVIS", default=False)
+ _travis_job_id = TypedEnv.Str("TRAVIS_JOB_ID")
+ _jenkins_job_id = TypedEnv.Str("BUILD_ID")
+
+ @property
+ def job_id(self):
+ return self._travis_job_id if self.is_travis else self._jenkins_job_id
+
+
+
+TypedEnv vs. local.env
+^^^^^^^^^^^^^^^^^^^^^^
+
+It is important to note that ``TypedEnv`` is separate and unrelated to the ``LocalEnv`` object that is provided via ``local.env``.
+
+While ``TypedEnv`` reads and writes directly to ``os.environ``,
+``local.env`` is a frozen copy taken at the start of the python session.
+
+While ``TypedEnv`` is focused on parsing environment variables to be used by the current process,
+``local.env``'s primary purpose is to manipulate the environment for child processes that are spawned
+via plumbum's :ref:`local commands <guide-local-commands>`.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/plumbum/commands/base.py new/plumbum-1.6.9/plumbum/commands/base.py
--- old/plumbum-1.6.8/plumbum/commands/base.py 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/plumbum/commands/base.py 2020-03-23 14:25:44.000000000 +0100
@@ -143,7 +143,6 @@
raise NotImplementedError()
def nohup(self,
- command,
cwd='.',
stdout='nohup.out',
stderr=None,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/plumbum/commands/modifiers.py new/plumbum-1.6.9/plumbum/commands/modifiers.py
--- old/plumbum-1.6.8/plumbum/commands/modifiers.py 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/plumbum/commands/modifiers.py 2020-03-23 14:25:44.000000000 +0100
@@ -374,7 +374,7 @@
else:
stdout = self.stdout
append = self.append
- return cmd.nohup(cmd, self.cwd, stdout, self.stderr, append)
+ return cmd.nohup(self.cwd, stdout, self.stderr, append)
NOHUP = _NOHUP()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/plumbum/commands/processes.py new/plumbum-1.6.9/plumbum/commands/processes.py
--- old/plumbum-1.6.8/plumbum/commands/processes.py 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/plumbum/commands/processes.py 2020-03-23 14:25:44.000000000 +0100
@@ -1,7 +1,6 @@
import time
import atexit
import heapq
-from subprocess import Popen
from threading import Thread
from plumbum.lib import IS_WIN32, six
@@ -24,7 +23,7 @@
return proc.returncode, stdout, stderr
-def _iter_lines(proc, decode, linesize, line_timeout=None):
+def _iter_lines_posix(proc, decode, linesize, line_timeout=None):
try:
from selectors import DefaultSelector, EVENT_READ
except ImportError:
@@ -62,6 +61,62 @@
yield 1, decode(line)
+def _iter_lines_win32(proc, decode, linesize, line_timeout=None):
+
+ class Piper(Thread):
+
+ def __init__(self, fd, pipe):
+ super().__init__(name="PlumbumPiper%sThread" % fd)
+ self.pipe = pipe
+ self.fd = fd
+ self.empty = False
+ self.daemon = True
+ super().start()
+
+ def read_from_pipe(self):
+ return self.pipe.readline(linesize)
+
+ def run(self):
+ for line in iter(self.read_from_pipe, b''):
+ queue.put((self.fd, decode(line)))
+ # self.pipe.close()
+
+ if line_timeout is None:
+ line_timeout = float("inf")
+ queue = Queue()
+ pipers = [Piper(0, proc.stdout), Piper(1, proc.stderr)]
+ last_line_ts = time.time()
+ empty = True
+ while True:
+ try:
+ yield queue.get_nowait()
+ last_line_ts = time.time()
+ empty = False
+ except QueueEmpty:
+ empty = True
+ if time.time() - last_line_ts > line_timeout:
+ raise ProcessLineTimedOut("popen line timeout expired", getattr(proc, "argv", None), getattr(proc, "machine", None))
+ if proc.poll() is not None:
+ break
+ if empty:
+ time.sleep(0.1)
+
+ for piper in pipers:
+ piper.join()
+
+ while True:
+ try:
+ yield queue.get_nowait()
+ except QueueEmpty:
+ break
+
+
+if IS_WIN32:
+ _iter_lines = _iter_lines_win32
+else:
+ _iter_lines = _iter_lines_posix
+
+
#===================================================================================================
# Exceptions
#===================================================================================================
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/plumbum/machines/local.py new/plumbum-1.6.9/plumbum/machines/local.py
--- old/plumbum-1.6.8/plumbum/machines/local.py 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/plumbum/machines/local.py 2020-03-23 14:25:44.000000000 +0100
@@ -42,6 +42,12 @@
def __iter__(self):
return self.iter_lines()
+ def __enter__(self):
+ return self._proc.__enter__()
+
+ def __exit__(self, *args, **kwargs):
+ return self._proc.__exit__(*args, **kwargs)
+
def __getattr__(self, name):
return getattr(self._proc, name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/plumbum/path/base.py new/plumbum-1.6.9/plumbum/path/base.py
--- old/plumbum-1.6.8/plumbum/path/base.py 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/plumbum/path/base.py 2020-03-23 14:25:44.000000000 +0100
@@ -38,7 +38,11 @@
return self.join(other)
__truediv__ = __div__
- __getitem__ = __div__
+
+ def __getitem__(self, key):
+ if type(key) == str or isinstance(key, Path):
+ return self / key
+ return str(self)[key]
def __floordiv__(self, expr):
"""Returns a (possibly empty) list of paths that matched the glob-pattern under this path"""
@@ -414,7 +418,7 @@
results.extend(fn(single_pattern))
return sorted(list(set(results)))
- def resolve(strict=False):
+ def resolve(self, strict=False):
"""Added to allow pathlib like syntax. Does nothing since
Plumbum paths are always absolute. Does not (currently) resolve
symlinks."""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/plumbum/path/local.py new/plumbum-1.6.9/plumbum/path/local.py
--- old/plumbum-1.6.8/plumbum/path/local.py 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/plumbum/path/local.py 2020-03-23 14:25:44.000000000 +0100
@@ -58,6 +58,9 @@
cls, os.path.normpath(os.path.join(*(str(p) for p in parts))))
return self
+ def __fspath__(self):
+ return self._path()
+
@property
def _path(self):
return str(self)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/plumbum/path/remote.py new/plumbum-1.6.9/plumbum/path/remote.py
--- old/plumbum-1.6.8/plumbum/path/remote.py 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/plumbum/path/remote.py 2020-03-23 14:25:44.000000000 +0100
@@ -3,6 +3,7 @@
from plumbum.path.base import Path, FSUser
from plumbum.lib import _setdoc, six
from plumbum.commands import shquote, ProcessExecutionError
+import os
import sys
try: # Py3
@@ -170,7 +171,7 @@
def stat(self):
res = self.remote._path_stat(self)
if res is None:
- raise OSError(errno.ENOENT)
+ raise OSError(errno.ENOENT, os.strerror(errno.ENOENT), '')
return res
@_setdoc(Path)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/plumbum/typed_env.py new/plumbum-1.6.9/plumbum/typed_env.py
--- old/plumbum-1.6.8/plumbum/typed_env.py 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/plumbum/typed_env.py 2020-03-23 14:25:44.000000000 +0100
@@ -6,6 +6,11 @@
NO_DEFAULT = object()
+# must not inherit from AttributeError, so not to mess with python's attribute-lookup flow
+class EnvironmentVariableError(KeyError):
+ pass
+
+
class TypedEnv(MutableMapping):
"""
This object can be used in 'exploratory' mode:
@@ -29,7 +34,7 @@
try:
print(p.tmp)
- except KeyError:
+ except EnvironmentVariableError:
print("TMP/TEMP is not defined")
else:
assert False
@@ -52,7 +57,7 @@
return self
try:
return self.convert(instance._raw_get(*self.names))
- except KeyError:
+ except EnvironmentVariableError:
if self.default is NO_DEFAULT:
raise
return self.default
@@ -64,6 +69,10 @@
pass
class Bool(_BaseVar):
+ """
+ Converts 'yes|true|1|no|false|0' to the appropriate boolean value.
+ Case-insensitive. Throws a ``ValueError`` for any other value.
+ """
def convert(self, s):
s = s.lower()
@@ -81,6 +90,10 @@
convert = staticmethod(float)
class CSV(_BaseVar):
+ """
+ Comma-separated-strings get split using the ``separator`` (',' by default) into
+ a list of objects of type ``type`` (``str`` by default).
+ """
def __init__(self, name, default=NO_DEFAULT, type=str, separator=","):
super(TypedEnv.CSV, self).__init__(name, default=default)
@@ -117,12 +130,12 @@
if value is not NO_DEFAULT:
return value
else:
- raise KeyError(key_names[0])
+ raise EnvironmentVariableError(key_names[0])
def __contains__(self, key):
try:
self._raw_get(key)
- except KeyError:
+ except EnvironmentVariableError:
return False
else:
return True
@@ -131,7 +144,7 @@
# if we're here then there was no descriptor defined
try:
return self._raw_get(name)
- except KeyError:
+ except EnvironmentVariableError:
raise AttributeError("%s has no attribute %r" % (self.__class__, name))
def __getitem__(self, key):
@@ -140,7 +153,7 @@
def get(self, key, default=None):
try:
return self[key]
- except KeyError:
+ except EnvironmentVariableError:
return default
def __dir__(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/plumbum/version.py new/plumbum-1.6.9/plumbum/version.py
--- old/plumbum-1.6.8/plumbum/version.py 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/plumbum/version.py 2020-03-23 14:25:44.000000000 +0100
@@ -1,3 +1,3 @@
-version = (1, 6, 8)
+version = (1, 6, 9)
version_string = ".".join(map(str, version))
-release_date = "2019.10.30"
+release_date = "2020.03.23"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/setup.py new/plumbum-1.6.9/setup.py
--- old/plumbum-1.6.8/setup.py 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/setup.py 2020-03-23 14:25:44.000000000 +0100
@@ -80,8 +80,10 @@
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
"Topic :: Software Development :: Build Tools",
"Topic :: System :: Systems Administration",
],
+ python_requires='>=2.6,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/plumbum-1.6.8/tests/test_local.py new/plumbum-1.6.9/tests/test_local.py
--- old/plumbum-1.6.8/tests/test_local.py 2019-10-30 22:21:12.000000000 +0100
+++ new/plumbum-1.6.9/tests/test_local.py 2020-03-23 14:25:44.000000000 +0100
@@ -8,7 +8,7 @@
CommandNotFound, ProcessExecutionError, ProcessTimedOut, ProcessLineTimedOut)
from plumbum.lib import six, IS_WIN32
from plumbum.fs.atomic import AtomicFile, AtomicCounterFile, PidFile
-from plumbum.machines.local import LocalCommand
+from plumbum.machines.local import LocalCommand, PlumbumLocalPopen
from plumbum.path import RelativePath
import plumbum
@@ -23,6 +23,18 @@
SDIR = os.path.dirname(os.path.abspath(__file__))
+class TestLocalPopen:
+ @pytest.mark.skipif(sys.version_info < (3, 2),
+ reason="Context Manager was introduced in Python 3.2")
+ def test_contextmanager(self):
+ if IS_WIN32:
+ command = ['dir']
+ else:
+ command = ['ls']
+ with PlumbumLocalPopen(command):
+ pass
+
+
class TestLocalPath:
longpath = local.path("/some/long/path/to/file.txt")
@@ -267,6 +279,11 @@
(tmp / "py_333").chmod(0o777)
assert not tmp.exists()
+ def test_str_getitem(self):
+ with local.tempdir() as tmp:
+ assert str(tmp) == str(tmp[:])
+ assert str(tmp)[0] == str(tmp[0])
+
@pytest.mark.usefixtures("testdir")
class TestLocalMachine: