-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from stephenfin/trivial
Fix errant docstring, formatting
- Loading branch information
Showing
35 changed files
with
513 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9402d8dcdf7b0a1a1e004f56b7bcfc0070fa9f60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# fixtures: Fixtures with cleanups for testing and convenience. | ||
# | ||
# Copyright (c) 2010, 2011, Robert Collins <[email protected]> | ||
# | ||
# | ||
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause | ||
# license at the users choice. A copy of both licenses are available in the | ||
# project source as Apache-2.0 and BSD. You may not use this file except in | ||
# compliance with one of these two licences. | ||
# | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
|
@@ -47,42 +47,42 @@ | |
from fixtures._fixtures.environ import ( | ||
EnvironmentVariable, | ||
EnvironmentVariableFixture, | ||
) | ||
) | ||
from fixtures._fixtures.logger import ( | ||
FakeLogger, | ||
LoggerFixture, | ||
LogHandler, | ||
) | ||
) | ||
from fixtures._fixtures.mockpatch import ( | ||
MockPatch, | ||
MockPatchMultiple, | ||
MockPatchObject, | ||
) | ||
) | ||
from fixtures._fixtures.monkeypatch import MonkeyPatch | ||
from fixtures._fixtures.popen import ( | ||
FakePopen, | ||
PopenFixture, | ||
) | ||
) | ||
from fixtures._fixtures.packagepath import PackagePathEntry | ||
from fixtures._fixtures.pythonpackage import PythonPackage | ||
from fixtures._fixtures.pythonpath import PythonPathEntry | ||
from fixtures._fixtures.streams import ( | ||
ByteStream, | ||
DetailStream, | ||
StringStream, | ||
) | ||
) | ||
from fixtures._fixtures.tempdir import ( | ||
NestedTempfile, | ||
TempDir, | ||
) | ||
) | ||
from fixtures._fixtures.temphomedir import ( | ||
TempHomeDir, | ||
) | ||
) | ||
from fixtures._fixtures.timeout import ( | ||
Timeout, | ||
TimeoutException, | ||
) | ||
) | ||
from fixtures._fixtures.warnings import ( | ||
WarningsCapture, | ||
WarningsFilter, | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
# fixtures: Fixtures with cleanups for testing and convenience. | ||
# | ||
# Copyright (c) 2011, Robert Collins <[email protected]> | ||
# | ||
# | ||
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause | ||
# license at the users choice. A copy of both licenses are available in the | ||
# project source as Apache-2.0 and BSD. You may not use this file except in | ||
# compliance with one of these two licences. | ||
# | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# license you chose for the specific language governing permissions and | ||
# limitations under that license. | ||
|
||
__all__ = [ | ||
'PackagePathEntry' | ||
] | ||
'PackagePathEntry', | ||
] | ||
|
||
import sys | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# fixtures: Fixtures with cleanups for testing and convenience. | ||
# | ||
# Copyright (c) 2010, 2011, Robert Collins <[email protected]> | ||
# | ||
# | ||
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause | ||
# license at the users choice. A copy of both licenses are available in the | ||
# project source as Apache-2.0 and BSD. You may not use this file except in | ||
# compliance with one of these two licences. | ||
# | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
|
@@ -15,8 +15,8 @@ | |
|
||
__all__ = [ | ||
'FakePopen', | ||
'PopenFixture' | ||
] | ||
'PopenFixture', | ||
] | ||
|
||
import random | ||
import subprocess | ||
|
@@ -90,7 +90,7 @@ class FakePopen(Fixture): | |
|
||
_unpassed = object() | ||
|
||
def __init__(self, get_info=lambda _:{}): | ||
def __init__(self, get_info=lambda _: {}): | ||
"""Create a PopenFixture | ||
:param get_info: Optional callback to control the behaviour of the | ||
|
@@ -100,7 +100,7 @@ def __init__(self, get_info=lambda _:{}): | |
dict, making it possible to detect the difference between 'passed | ||
with a default value' and 'not passed at all'. | ||
e.g. | ||
e.g. | ||
def get_info(proc_args): | ||
self.assertEqual(subprocess.PIPE, proc_args['stdin']) | ||
return {'stdin': StringIO('foobar')} | ||
|
@@ -123,47 +123,94 @@ def _setUp(self): | |
|
||
# The method has the correct signature so we error appropriately if called | ||
# wrongly. | ||
def __call__(self, args, bufsize=_unpassed, executable=_unpassed, | ||
stdin=_unpassed, stdout=_unpassed, stderr=_unpassed, | ||
preexec_fn=_unpassed, close_fds=_unpassed, shell=_unpassed, | ||
cwd=_unpassed, env=_unpassed, universal_newlines=_unpassed, | ||
startupinfo=_unpassed, creationflags=_unpassed, | ||
restore_signals=_unpassed, start_new_session=_unpassed, | ||
pass_fds=_unpassed, *, group=_unpassed, extra_groups=_unpassed, | ||
user=_unpassed, umask=_unpassed, encoding=_unpassed, | ||
errors=_unpassed, text=_unpassed, pipesize=_unpassed, | ||
process_group=_unpassed): | ||
def __call__( | ||
self, | ||
args, | ||
bufsize=_unpassed, | ||
executable=_unpassed, | ||
stdin=_unpassed, | ||
stdout=_unpassed, | ||
stderr=_unpassed, | ||
preexec_fn=_unpassed, | ||
close_fds=_unpassed, | ||
shell=_unpassed, | ||
cwd=_unpassed, | ||
env=_unpassed, | ||
universal_newlines=_unpassed, | ||
startupinfo=_unpassed, | ||
creationflags=_unpassed, | ||
restore_signals=_unpassed, | ||
start_new_session=_unpassed, | ||
pass_fds=_unpassed, | ||
*, | ||
group=_unpassed, | ||
extra_groups=_unpassed, | ||
user=_unpassed, | ||
umask=_unpassed, | ||
encoding=_unpassed, | ||
errors=_unpassed, | ||
text=_unpassed, | ||
pipesize=_unpassed, | ||
process_group=_unpassed | ||
): | ||
# Reject arguments introduced by newer versions of Python in older | ||
# versions; this makes it harder to accidentally hide compatibility | ||
# problems using test doubles. | ||
if sys.version_info < (3, 7) and text is not FakePopen._unpassed: | ||
raise TypeError( | ||
"FakePopen.__call__() got an unexpected keyword argument " | ||
"'text'") | ||
"'text'" | ||
) | ||
if sys.version_info < (3, 9): | ||
for arg_name in "group", "extra_groups", "user", "umask": | ||
if locals()[arg_name] is not FakePopen._unpassed: | ||
raise TypeError( | ||
"FakePopen.__call__() got an unexpected keyword " | ||
"argument '{}'".format(arg_name)) | ||
"argument '{}'".format(arg_name) | ||
) | ||
if sys.version_info < (3, 10) and pipesize is not FakePopen._unpassed: | ||
raise TypeError( | ||
"FakePopen.__call__() got an unexpected keyword argument " | ||
"'pipesize'") | ||
if sys.version_info < (3, 11) and process_group is not FakePopen._unpassed: | ||
"'pipesize'" | ||
) | ||
if ( | ||
sys.version_info < (3, 11) | ||
and process_group is not FakePopen._unpassed | ||
): | ||
raise TypeError( | ||
"FakePopen.__call__() got an unexpected keyword argument " | ||
"'process_group'") | ||
"'process_group'" | ||
) | ||
|
||
proc_args = dict(args=args) | ||
local = locals() | ||
for param in [ | ||
"bufsize", "executable", "stdin", "stdout", "stderr", | ||
"preexec_fn", "close_fds", "shell", "cwd", "env", | ||
"universal_newlines", "startupinfo", "creationflags", | ||
"restore_signals", "start_new_session", "pass_fds", "group", | ||
"extra_groups", "user", "umask", "encoding", "errors", "text", | ||
"pipesize", "process_group"]: | ||
"bufsize", | ||
"executable", | ||
"stdin", | ||
"stdout", | ||
"stderr", | ||
"preexec_fn", | ||
"close_fds", | ||
"shell", | ||
"cwd", | ||
"env", | ||
"universal_newlines", | ||
"startupinfo", | ||
"creationflags", | ||
"restore_signals", | ||
"start_new_session", | ||
"pass_fds", | ||
"group", | ||
"extra_groups", | ||
"user", | ||
"umask", | ||
"encoding", | ||
"errors", | ||
"text", | ||
"pipesize", | ||
"process_group", | ||
]: | ||
if local[param] is not FakePopen._unpassed: | ||
proc_args[param] = local[param] | ||
proc_info = self.get_info(proc_args) | ||
|
Oops, something went wrong.