UseCases.FileSysObjects.addAndRemoveEntries package¶
Submodules¶
UseCases.FileSysObjects.addAndRemoveEntries.CallCase module¶
Create a plist, find a matching relative filepathname in directory tree.
Calling elementary functions.
Data:
see 'testdata.examples'
refer also to the manual [filesystem-elements-as-objects]
Call:
import testdata import filesysobjects.FileSysObjects # start of upward search - file is converted into it's containing directory node s = os.sep any_sub_path = os.path.normpath('examples/a/b0/c/a/b0/c/F') spath = testdata.mypath spath += any_sub_path # Here an empty list is used for search only. The function adds # entries to the provided list storage, thus e.g. to 'sys.path' too. _plist = [] # 0. build a search path list - if not yet available # adds each directory from spath to its matching # subnode "a/b" # setUpperTreeSearchPath(spath,os.path.normpath('b/B.txt'), _plist) rp = findRelPathInSearchPath(spath,_plist) _addp = _plist_ref[-1] # 1. append an item _px = addPathToSearchPath(_addp, _plist,**{'append':True}) # 2. remove the item delPathFromSearchPath(_addp, _plist)
Result:
expected = os.path.normpath(testdata.mypath+'/examples/a/b0/c/a/b0/F1')
-
class
UseCases.FileSysObjects.addAndRemoveEntries.CallCase.
UseCase
(*args, **kargs)[source]¶ Bases:
unittest.case.TestCase
-
test_UseCase020_append_try_same_again_nonredundant
()[source]¶ - try to add same item again - with failure
-