Disk

Allows definition of disk entities, such as Directories and File Objects to be tested as part of the defining scope. It also store a reference of the object for later access.

class Disk
Directory(name, exists=None, id=None, runtime=True)

Creates a new Directory object.

Parameters:
  • name – The path to the file. This is relative to the runtime state.

  • exists – Can be set to True to test that the file exists or False to test that it does not exist Can be set to a tester object for a custom test

  • id – a custom value that can be used to refer to the file as part of the Disk object later in the test file

  • runtime – Can be normally ignored. By default this is True which mean the relative path is based on the current sandbox/runtime path is the root. If False the relative path is based on the current location of the test file

File(name, exists=None, size=None, content=None, execute=None, id=None, runtime=True, typename=None)

Creates a new File object.

Parameters:
  • name – The path to the file. This is relative to the runtime state.

  • exists (Optional[bool]) – Can be set to True to test that the file exists or False to test that it does not exist Can be set to a tester object for a custom test.

  • size (Optional[int]) – Can be set a integer value greater or equal to 0 to test that file matches the exact size. Can be set to a tester object for a custom test.

  • execute – currently ignored

  • id (str) – A custom value that can be used to refer to the file as part of the Disk object later in the test file.

  • runtime (bool) – Can be normally ignored. By default this is True which mean the relative path is based on the current sandbox/runtime path is the root. If False the relative path is based on the current location of the test file.

  • typename (Optional[str]) – Control if the file should be of a certain type. This allows creation of File objects that might have extended functionality such as reading and writing json files via a dictionary interface.

Note

Items that are created can be given an id argument which will be used to when making the new entity a member of the Disk object.

Example

Test.Disk.File("foo.txt",id="foo")
Test.Disk.foo.Exists = True

Likewise all item can be accessed can be accesses via a read only dictionary interface. This allow accessing entities that do not have language friendly names.

Example

Test.Disk.File("dir/foo.txt")
Test.Disk["dir/foo.txt"].Exists = True