mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-13 22:42:29 +03:00
convert tests/testcommon.py to black code format
This commit is contained in:
parent
617a9e75c7
commit
261be20109
2 changed files with 8 additions and 15 deletions
|
@ -52,7 +52,6 @@ force-exclude = '''(
|
||||||
| tests/extra/manual-vmtools-test\.py
|
| tests/extra/manual-vmtools-test\.py
|
||||||
| tests/gradle-release-checksums\.py
|
| tests/gradle-release-checksums\.py
|
||||||
| tests/openssl-version-check-test\.py
|
| tests/openssl-version-check-test\.py
|
||||||
| tests/testcommon\.py
|
|
||||||
| tests/valid-package-names/test\.py
|
| tests/valid-package-names/test\.py
|
||||||
| tests/checkupdates\.TestCase
|
| tests/checkupdates\.TestCase
|
||||||
| tests/common\.TestCase
|
| tests/common\.TestCase
|
||||||
|
|
|
@ -20,10 +20,8 @@ import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
class TmpCwd():
|
class TmpCwd:
|
||||||
"""Context-manager for temporarily changing the current working
|
"""Context-manager for temporarily changing the current working directory."""
|
||||||
directory.
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, new_cwd):
|
def __init__(self, new_cwd):
|
||||||
self.new_cwd = new_cwd
|
self.new_cwd = new_cwd
|
||||||
|
@ -36,9 +34,8 @@ class TmpCwd():
|
||||||
os.chdir(self.orig_cwd)
|
os.chdir(self.orig_cwd)
|
||||||
|
|
||||||
|
|
||||||
class TmpPyPath():
|
class TmpPyPath:
|
||||||
"""Context-manager for temporarily adding a direcory to python path
|
"""Context-manager for temporarily adding a directory to Python path."""
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, additional_path):
|
def __init__(self, additional_path):
|
||||||
self.additional_path = additional_path
|
self.additional_path = additional_path
|
||||||
|
@ -51,14 +48,11 @@ class TmpPyPath():
|
||||||
|
|
||||||
|
|
||||||
def mock_open_to_str(mock):
|
def mock_open_to_str(mock):
|
||||||
"""
|
"""For accessing all data written into a unittest.mock.mock_open() instance as a string."""
|
||||||
helper function for accessing all data written into a
|
|
||||||
unittest.mock.mock_open() instance as a string.
|
|
||||||
"""
|
|
||||||
|
|
||||||
return "".join([
|
return "".join(
|
||||||
x.args[0] for x in mock.mock_calls if str(x).startswith("call().write(")
|
[x.args[0] for x in mock.mock_calls if str(x).startswith("call().write(")]
|
||||||
])
|
)
|
||||||
|
|
||||||
|
|
||||||
def mkdtemp():
|
def mkdtemp():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue