tests: reformat tests using black.
This commit is contained in:
parent
42263d05f9
commit
5005ca346b
1 changed files with 161 additions and 140 deletions
|
|
@ -35,13 +35,13 @@ class LiberviaCliJson:
|
|||
def __call__(self, *args, **kwargs):
|
||||
args = self.subcommands + list(args)
|
||||
self.subcommands.clear()
|
||||
kwargs['output'] = 'json-raw'
|
||||
kwargs['_tty_out'] = False
|
||||
kwargs["output"] = "json-raw"
|
||||
kwargs["_tty_out"] = False
|
||||
cmd = li(*args, **kwargs)
|
||||
return json.loads(cmd)
|
||||
|
||||
def __getattr__(self, name):
|
||||
if name.startswith('_'):
|
||||
if name.startswith("_"):
|
||||
# no li subcommand starts with a "_",
|
||||
# and pytest uses some attributes with this name scheme
|
||||
return super().__getattr__(name)
|
||||
|
|
@ -55,13 +55,14 @@ class LiberviaCliElt(LiberviaCliJson):
|
|||
def __init__(self):
|
||||
super().__init__()
|
||||
from libervia.backend.tools.xml_tools import ElementParser
|
||||
|
||||
self.parser = ElementParser()
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
args = self.subcommands + list(args)
|
||||
self.subcommands.clear()
|
||||
kwargs['output'] = 'xml-raw'
|
||||
kwargs['_tty_out'] = False
|
||||
kwargs["output"] = "xml-raw"
|
||||
kwargs["_tty_out"] = False
|
||||
cmd = li(*args, **kwargs)
|
||||
return self.parser(cmd.strip())
|
||||
|
||||
|
|
@ -79,7 +80,8 @@ class Editor:
|
|||
self.editor_path = self.tmp_dir_path / "editor.py"
|
||||
self.ori_content_path = self.tmp_dir_path / "original_content"
|
||||
self.new_content_path = self.tmp_dir_path / "new_content"
|
||||
self.base_script = dedent(f"""\
|
||||
self.base_script = dedent(
|
||||
f"""\
|
||||
#!{sys.executable}
|
||||
import sys
|
||||
|
||||
|
|
@ -111,9 +113,9 @@ class Editor:
|
|||
If filter_ is not specified, original content is written unmodified.
|
||||
Code must be on a single line.
|
||||
"""
|
||||
if '\n' in content_filter:
|
||||
if "\n" in content_filter:
|
||||
raise ValueError("new lines can't be used in filter_")
|
||||
with self.editor_path.open('w') as f:
|
||||
with self.editor_path.open("w") as f:
|
||||
f.write(self.base_script.format(content_filter=content_filter))
|
||||
self.editor_path.chmod(0o700)
|
||||
self.editor_set = True
|
||||
|
|
|
|||
Loading…
Reference in a new issue