copy#
- copy(*files: str, src: str | None = None, dst: str | None = None, when: str | dict[str, str] | None = None) None#
Copy files from the source directory into the execution directory.
Usage#
.pyt:import canary canary.directives.copy(*files, when=...) canary.directives.copy(src=..., dst=..., when=...)
.vvt:#VVT: copy (rename, options=..., platforms=..., parameters=..., testname=...) : files ...Parameters#
files: File names to copysrc: Source file to copydst: Copysrcto this destinationwhen: Restrict processing of the directive to this condition
The
whenexpression is limited to the following conditions:testname: Restrict processing of the directive to this test nameplatforms: Restrict processing of the directive to certain platform or platformsoptions: Restrict processing of the directive to command line-ooptionsparameters: Restrict processing of the directive to certain parameter names and values
Note
The
filespositional arguments andsrc,dstkeyword arguments are mutually exclusive.Examples#
Copy files
input.txtandhelper.pyfrom the source directory to the execution directoryimport canary canary.directives.copy("input.txt", "helper.py")
#VVT: copy : input.txt helper.py
Copy files
file1.txtandfile2.txtfrom the source directory to the execution directory and rename themimport canary canary.directives.copy(src="file1.txt", dst="file1_copy.txt") canary.directives.copy(src="file2.txt", dst="file2_copy.txt")
#VVT: copy (rename) : file1.txt,file1_copy.txt file2.txt,file2_copy.txt
Copy files
spam.txtandeggs.txtfrom the source directory to the execution directory if the parameterbreakfast=spamorbreakfast=eggs, respectivelyimport canary canary.directives.parameterize("breakfast", ("spam", "eggs")) canary.directives.copy("spam.txt", when={"parameters": "breakfast=spam"}) canary.directives.copy("eggs.txt", when={"parameters": "breakfast=eggs"})
#VVT: parameterize : breakfast = spam eggs #VVT: copy (parameters='breakfast=spam') : spam.txt #VVT: copy (parameters='breakfast=eggs') : eggs.txt