fix: fix 'attribute-defined-outside-init' for pylint
This commit is contained in:
parent
d9db40fddc
commit
957c334d1d
8 changed files with 34 additions and 58 deletions
|
@ -12,7 +12,6 @@ from wuttjamaican.testing import ConfigTestCase
|
|||
|
||||
|
||||
class TestInstallHandler(ConfigTestCase):
|
||||
|
||||
def make_handler(self, **kwargs):
|
||||
return mod.InstallHandler(self.config, **kwargs)
|
||||
|
||||
|
@ -38,7 +37,6 @@ class TestInstallHandler(ConfigTestCase):
|
|||
with patch.object(mod, "sys") as sys:
|
||||
with patch.object(handler, "rprint") as rprint:
|
||||
with patch.object(handler, "prompt_bool") as prompt_bool:
|
||||
|
||||
# user continues
|
||||
prompt_bool.return_value = True
|
||||
handler.show_welcome()
|
||||
|
@ -54,7 +52,6 @@ class TestInstallHandler(ConfigTestCase):
|
|||
with patch.object(mod, "sys") as sys:
|
||||
with patch.object(mod, "os") as os:
|
||||
with patch.object(handler, "rprint") as rprint:
|
||||
|
||||
# pretend appdir does not exist
|
||||
os.path.exists.return_value = False
|
||||
handler.sanity_check()
|
||||
|
@ -79,10 +76,9 @@ class TestInstallHandler(ConfigTestCase):
|
|||
with patch.object(handler, "get_dbinfo", return_value=dbinfo):
|
||||
with patch.object(handler, "make_appdir") as make_appdir:
|
||||
with patch.object(handler, "install_db_schema") as install_db_schema:
|
||||
|
||||
# nb. just for sanity/coverage
|
||||
install_db_schema.return_value = True
|
||||
self.assertFalse(hasattr(handler, "schema_installed"))
|
||||
self.assertFalse(handler.schema_installed)
|
||||
handler.do_install_steps()
|
||||
self.assertTrue(make_appdir.called)
|
||||
self.assertTrue(handler.schema_installed)
|
||||
|
@ -109,7 +105,6 @@ class TestInstallHandler(ConfigTestCase):
|
|||
with patch.object(handler, "prompt_generic", side_effect=prompt_generic):
|
||||
with patch.object(handler, "test_db_connection") as test_db_connection:
|
||||
with patch.object(handler, "rprint") as rprint:
|
||||
|
||||
# bad dbinfo
|
||||
test_db_connection.return_value = "bad dbinfo"
|
||||
sys.exit.side_effect = RuntimeError
|
||||
|
@ -220,7 +215,6 @@ default.url = {db_url}
|
|||
db_url = sa.create_engine(db_url).url
|
||||
|
||||
with patch.object(mod, "subprocess") as subprocess:
|
||||
|
||||
# user declines offer to install schema
|
||||
with patch.object(handler, "prompt_bool", return_value=False):
|
||||
self.assertFalse(handler.install_db_schema(db_url, appdir=self.tempdir))
|
||||
|
@ -321,7 +315,6 @@ default.url = {db_url}
|
|||
with patch("builtins.__import__", side_effect=mock_import):
|
||||
with patch.object(handler, "get_prompt_style", return_value=style):
|
||||
with patch.object(handler, "rprint") as rprint:
|
||||
|
||||
# no input or default value
|
||||
mock_prompt.return_value = ""
|
||||
result = handler.prompt_generic("foo")
|
||||
|
@ -452,7 +445,6 @@ default.url = {db_url}
|
|||
|
||||
with patch("builtins.__import__", side_effect=mock_import):
|
||||
with patch.object(handler, "rprint") as rprint:
|
||||
|
||||
# no default; true input
|
||||
mock_prompt.reset_mock()
|
||||
mock_prompt.return_value = "Y"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue