nbnode.testutil package

Submodules

nbnode.testutil.get_licenses module

nbnode.testutil.helpers module

nbnode.testutil.helpers.find_dirname_above(dirpath: str, dirname: str = 'tests', max_iterations: int = 30, verbose: bool = False, realpath: bool = True) str[source]

Find dirname above.

Goes directory-wise upwards starting at dirpath and:

  1. current_directory = dirpath

  2. list content of current_directory and search for ‘dirname’.

2.1) If found, Return the path

2.2) If not found, # Ascend one directory, go to 1), current_directory = os.path.join(current_directory, ‘..’)

Parameters:
  • dirpath – current path

  • dirname – what to search for

  • max_iterations – Maximum number of going upwards in the directory-hierarchy (with os.pardir)

  • verbose – To be or not to be verbose

  • realpath – If true, return the os.path.realpath() of the returned path

Returns:

The first found path to the directory ‘dirname’

nbnode.testutil.helpers.find_dirname_above_currentfile(dirname: str = 'tests', max_iterations: int = 30, verbose: bool = False, realpath: bool = True) str[source]

Finds the given dirname above the file which called this function.

Parameters:
  • dirname – See find_dirname_above

  • max_iterations – See find_dirname_above

  • verbose – See find_dirname_above

  • realpath – See find_dirname_above

Returns:

The first found path to the directory ‘dirname’

Module contents