nixos/test-driver: accept non-\w* filenames
What the code was trying to do was helpfully add a directory and extension if none were specified, but it did this by checking whether the filename was composed of a very limited character set that didn't even include dashes. With this change, the intention of the code is clearer, and I can put dashes in my screenshot names.
This commit is contained in:
parent
78cd6d9833
commit
27f97953e0
1 changed files with 4 additions and 3 deletions
|
@ -737,9 +737,10 @@ class Machine:
|
|||
self.connected = True
|
||||
|
||||
def screenshot(self, filename: str) -> None:
|
||||
word_pattern = re.compile(r"^\w+$")
|
||||
if word_pattern.match(filename):
|
||||
filename = os.path.join(self.out_dir, f"{filename}.png")
|
||||
if "." not in filename:
|
||||
filename += ".png"
|
||||
if "/" not in filename:
|
||||
filename = os.path.join(self.out_dir, filename)
|
||||
tmp = f"{filename}.ppm"
|
||||
|
||||
with self.nested(
|
||||
|
|
Loading…
Reference in a new issue