Skip to content

Commit ef94664

Browse files
committed
Fix merge conflicts
2 parents 864db8e + 3feaaed commit ef94664

File tree

13 files changed

+43
-76
lines changed

13 files changed

+43
-76
lines changed

.azure-pipelines.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ jobs:
2626
vmImage: ubuntu-latest
2727
strategy:
2828
matrix:
29-
python35:
30-
PYTHON_VERSION: 3.5
3129
python36:
3230
PYTHON_VERSION: 3.6
3331
python37:
@@ -43,8 +41,6 @@ jobs:
4341
vmImage: macOS-latest
4442
strategy:
4543
matrix:
46-
python35:
47-
PYTHON_VERSION: 3.5
4844
python36:
4945
PYTHON_VERSION: 3.6
5046
python37:
@@ -60,8 +56,6 @@ jobs:
6056
vmImage: windows-latest
6157
strategy:
6258
matrix:
63-
python35:
64-
PYTHON_VERSION: 3.5
6559
python36:
6660
PYTHON_VERSION: 3.6
6761
python37:

.azure-pipelines/syntax-validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
continue
1313
filename = os.path.normpath(os.path.join(base, f))
1414
try:
15-
with open(filename, "r") as fh:
15+
with open(filename) as fh:
1616
ast.parse(fh.read())
1717
except SyntaxError as se:
1818
failures += 1

.github/dependabot.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,3 @@ updates:
99
directory: "/" # Location of package manifests
1010
schedule:
1111
interval: "monthly"
12-
ignore:
13-
- dependency-name: "mock"
14-
# mock 4 requires Python 3.6+
15-
versions: [">=4"]
16-
- dependency-name: "twine"
17-
# twine 2 requires Python 3.6+
18-
versions: [">=2"]

.travis.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ matrix:
1212
- python: 3.8
1313
- python: 3.7
1414
- python: 3.6
15-
- python: 3.5
1615
- os: osx
1716
language: generic
1817
env: CONDA=3.8 TOXENV=py38
@@ -22,9 +21,6 @@ matrix:
2221
- os: osx
2322
language: generic
2423
env: CONDA=3.6 TOXENV=py36
25-
- os: osx
26-
language: generic
27-
env: CONDA=3.5 TOXENV=py35
2824

2925
allow_failures:
3026
- env: OPTIONAL=1

HISTORY.rst

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
History
33
=======
44

5+
2.3.0 (????-??-??)
6+
------------------
7+
* Python 3.6+ only, support for Python 3.5 has been dropped
8+
59
2.2.0 (2020-09-07)
610
------------------
711
* Calling the run() function with unnamed arguments (other than the command
@@ -28,70 +32,58 @@ History
2832

2933
2.0.0 (2020-06-24)
3034
------------------
31-
3235
* Python 3.5+ only, support for Python 2.7 has been dropped
3336
* Deprecated function alias run_process() has been removed
3437
* Fixed a stability issue on Windows
3538

3639
1.1.0 (2019-11-04)
3740
------------------
38-
3941
* Add Python 3.8 support, drop Python 3.4 support
4042

4143
1.0.2 (2019-05-20)
4244
------------------
43-
4445
* Stop environment override variables leaking into the process environment
4546

4647
1.0.1 (2019-04-16)
4748
------------------
48-
4949
* Minor fixes on the return object (implement equality,
5050
mark as unhashable)
5151

5252
1.0.0 (2019-03-25)
5353
------------------
54-
5554
* Support file system path objects (PEP-519) in arguments
5655
* Change the return object to make it similar to
5756
subprocess.CompletedProcess, introduced with Python 3.5+
5857

5958
0.9.1 (2019-02-22)
6059
------------------
61-
6260
* Have deprecation warnings point to correct code locations
6361

6462
0.9.0 (2018-12-07)
6563
------------------
66-
6764
* Trap UnicodeEncodeError when printing output. Offending characters
6865
are replaced and a warning is logged once. Hints at incorrectly set
6966
PYTHONIOENCODING.
7067

7168
0.8.1 (2018-12-04)
7269
------------------
73-
7470
* Fix a few deprecation warnings
7571

7672
0.8.0 (2018-10-09)
7773
------------------
78-
7974
* Add parameter working_directory to set the working directory
8075
of the subprocess
8176

8277
0.7.2 (2018-10-05)
8378
------------------
84-
8579
* Officially support Python 3.7
8680

8781
0.7.1 (2018-09-03)
8882
------------------
89-
9083
* Accept environment variable overriding with numeric values.
9184

9285
0.7.0 (2018-05-13)
9386
------------------
94-
9587
* Unicode fixes. Fix crash on invalid UTF-8 input.
9688
* Clarify that stdout/stderr values are returned as bytestrings.
9789
* Callbacks receive the data decoded as UTF-8 unicode strings
@@ -101,23 +93,19 @@ History
10193

10294
0.6.1 (2018-05-02)
10395
------------------
104-
10596
* Maintenance release to add some tests for executable resolution.
10697

10798
0.6.0 (2018-05-02)
10899
------------------
109-
110100
* Fix Win32 API executable resolution for commands containing a dot ('.') in
111101
addition to a file extension (say '.bat').
112102

113103
0.5.1 (2018-04-27)
114104
------------------
115-
116105
* Fix Win32API dependency installation on Windows.
117106

118107
0.5.0 (2018-04-26)
119108
------------------
120-
121109
* New keyword 'win32resolve' which only takes effect on Windows and is enabled
122110
by default. This causes procrunner to call the Win32 API FindExecutable()
123111
function to try and lookup non-.exe files with the corresponding name. This
@@ -126,21 +114,17 @@ History
126114

127115
0.4.0 (2018-04-23)
128116
------------------
129-
130117
* Python 2.7 support on Windows. Python3 not yet supported on Windows.
131118

132119
0.3.0 (2018-04-17)
133120
------------------
134-
135121
* run_process() renamed to run()
136122
* Python3 compatibility fixes
137123

138124
0.2.0 (2018-03-12)
139125
------------------
140-
141126
* Procrunner is now Python3 3.3-3.6 compatible.
142127

143128
0.1.0 (2018-03-12)
144129
------------------
145-
146130
* First release on PyPI.

appveyor.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ environment:
55
# For Python versions available on Appveyor, see
66
# http://www.appveyor.com/docs/installed-software#python
77

8-
- PYTHON: "C:\\Python35"
98
- PYTHON: "C:\\Python36"
109
- PYTHON: "C:\\Python37"
1110
- PYTHON: "C:\\Python38"
12-
- PYTHON: "C:\\Python35-x64"
1311
- PYTHON: "C:\\Python36-x64"
1412
- PYTHON: "C:\\Python37-x64"
1513
- PYTHON: "C:\\Python38-x64"

procrunner/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def _path_resolve(obj):
275275
return obj
276276

277277

278-
def _windows_resolve(command):
278+
def _windows_resolve(command, path=None):
279279
"""
280280
Try and find the full path and file extension of the executable to run.
281281
This is so that e.g. calls to 'somescript' will point at 'somescript.cmd'
@@ -290,7 +290,7 @@ def _windows_resolve(command):
290290
if not command or not isinstance(command[0], str):
291291
return command
292292

293-
found_executable = shutil.which(command[0])
293+
found_executable = shutil.which(command[0], path=path)
294294
if found_executable:
295295
logger.debug("Resolved %s as %s", command[0], found_executable)
296296
return (found_executable, *command[1:])
@@ -299,7 +299,7 @@ def _windows_resolve(command):
299299
# Special case. shutil.which may not detect file extensions if a full
300300
# path is given, so try to resolve the executable explicitly
301301
for extension in os.getenv("PATHEXT").split(os.pathsep):
302-
found_executable = shutil.which(command[0] + extension)
302+
found_executable = shutil.which(command[0] + extension, path=path)
303303
if found_executable:
304304
return (found_executable, *command[1:])
305305

@@ -335,7 +335,7 @@ def __getitem__(self, key):
335335
if key in self._extras:
336336
return self._extras[key]
337337
if not hasattr(self, key):
338-
raise KeyError("Unknown attribute {key}".format(key=key))
338+
raise KeyError(f"Unknown attribute {key}")
339339
return getattr(self, key)
340340

341341
def __eq__(self, other):
@@ -518,11 +518,13 @@ def run(
518518
command = tuple(_path_resolve(part) for part in command)
519519
if win32resolve and sys.platform == "win32":
520520
command = _windows_resolve(command)
521+
if working_directory and sys.version_info < (3, 7):
522+
working_directory = os.fspath(working_directory)
521523

522524
p = subprocess.Popen(
523525
command,
524526
shell=False,
525-
cwd=_path_resolve(working_directory),
527+
cwd=working_directory,
526528
env=env,
527529
stdin=stdin_pipe,
528530
stdout=subprocess.PIPE,

requirements_dev.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
bump2version==1.0.0
22
coverage==5.3
33
flake8==3.8.3
4-
mock==3.0.5
54
pip==20.2.3
65
pytest==6.1.0
76
Sphinx==3.2.1

setup.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
setup_requirements = []
1515

16-
test_requirements = ["mock", "pytest"]
16+
test_requirements = ["pytest"]
1717

1818
setup(
1919
author="Markus Gerstel",
@@ -25,7 +25,6 @@
2525
"Natural Language :: English",
2626
"Operating System :: OS Independent",
2727
"Programming Language :: Python :: 3",
28-
"Programming Language :: Python :: 3.5",
2928
"Programming Language :: Python :: 3.6",
3029
"Programming Language :: Python :: 3.7",
3130
"Programming Language :: Python :: 3.8",
@@ -40,7 +39,7 @@
4039
keywords="procrunner",
4140
name="procrunner",
4241
packages=find_packages(include=["procrunner"]),
43-
python_requires=">=3.5",
42+
python_requires=">=3.6",
4443
setup_requires=setup_requirements,
4544
test_suite="tests",
4645
tests_require=test_requirements,

tests/test_procrunner.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import copy
2-
import mock
2+
from unittest import mock
33
import os
4+
import pathlib
45
import procrunner
56
import pytest
67
import sys
@@ -86,13 +87,16 @@ def streamreader_processing(*args, **kwargs):
8687
timeout=0.5,
8788
callback_stdout=mock.sentinel.callback_stdout,
8889
callback_stderr=mock.sentinel.callback_stderr,
89-
working_directory=mock.sentinel.cwd,
90+
working_directory=pathlib.Path("somecwd"),
9091
raise_timeout_exception=True,
9192
)
9293

9394
assert mock_subprocess.Popen.called
9495
assert mock_subprocess.Popen.call_args[1]["env"] == os.environ
95-
assert mock_subprocess.Popen.call_args[1]["cwd"] == mock.sentinel.cwd
96+
assert mock_subprocess.Popen.call_args[1]["cwd"] in (
97+
pathlib.Path("somecwd"),
98+
"somecwd",
99+
)
96100
mock_streamreader.assert_has_calls(
97101
[
98102
mock.call(

0 commit comments

Comments
 (0)