style
This commit is contained in:
parent
b8e58e9bd8
commit
b48dfe6589
@ -425,7 +425,7 @@ def env_view_setup_parser(subparser):
|
|||||||
"--force",
|
"--force",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
dest="force",
|
dest="force",
|
||||||
help="regenerate even if regeneration cannot be done atomically"
|
help="regenerate even if regeneration cannot be done atomically",
|
||||||
)
|
)
|
||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
"action", choices=ViewAction.actions(), help="action to take for the environment's view"
|
"action", choices=ViewAction.actions(), help="action to take for the environment's view"
|
||||||
|
@ -626,11 +626,8 @@ def raise_if_symlink_before_exchange(self, force):
|
|||||||
def raise_if_exchange_before_symlink(self, force):
|
def raise_if_exchange_before_symlink(self, force):
|
||||||
if os.path.isdir(self.root) and not os.path.islink(self.root):
|
if os.path.isdir(self.root) and not os.path.islink(self.root):
|
||||||
if force:
|
if force:
|
||||||
try:
|
shutil.rmtree(self.root, ignore_errors=True)
|
||||||
shutil.rmtree(self.root)
|
return
|
||||||
return
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
msg = f"The view at {self.root} cannot be updated with the 'symlink' update method"
|
msg = f"The view at {self.root} cannot be updated with the 'symlink' update method"
|
||||||
msg += " because it was originally constructed with the 'exchange' method."
|
msg += " because it was originally constructed with the 'exchange' method."
|
||||||
msg += "\n Either change the update method to 'exchange' or"
|
msg += "\n Either change the update method to 'exchange' or"
|
||||||
|
@ -3329,6 +3329,7 @@ def test_view_update_mismatch(update_method, tmpdir, install_mockery, mock_fetch
|
|||||||
view.regenerate([spec], force=True)
|
view.regenerate([spec], force=True)
|
||||||
assert os.path.exists(view.root)
|
assert os.path.exists(view.root)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("update_method", ["symlink", "exchange"])
|
@pytest.mark.parametrize("update_method", ["symlink", "exchange"])
|
||||||
def test_view_update_fails(update_method, tmpdir, install_mockery, mock_fetch, monkeypatch):
|
def test_view_update_fails(update_method, tmpdir, install_mockery, mock_fetch, monkeypatch):
|
||||||
root = str(tmpdir.join("root"))
|
root = str(tmpdir.join("root"))
|
||||||
|
Loading…
Reference in New Issue
Block a user