Add test coverage of GuiManuscript tool
This commit is contained in:
+9
-13
@@ -112,32 +112,28 @@ def cmpFiles(
|
||||
return not diffFound
|
||||
|
||||
|
||||
def getGuiItem(theName):
|
||||
"""Returns a QtWidget based on its objectName.
|
||||
"""
|
||||
def getGuiItem(name: str):
|
||||
"""Returns a QtWidget based on its objectName."""
|
||||
for qWidget in qApp.topLevelWidgets():
|
||||
if qWidget.objectName() == theName:
|
||||
if qWidget.objectName() == name:
|
||||
return qWidget
|
||||
return None
|
||||
|
||||
|
||||
def readFile(fileName):
|
||||
"""Returns the content of a file as a string.
|
||||
"""
|
||||
def readFile(fileName: str | Path):
|
||||
"""Returns the content of a file as a string."""
|
||||
with open(fileName, mode="r", encoding="utf-8") as inFile:
|
||||
return inFile.read()
|
||||
|
||||
|
||||
def writeFile(fileName, fileData):
|
||||
"""Write the contents of a string to a file.
|
||||
"""
|
||||
def writeFile(fileName: str | Path, fileData: str):
|
||||
"""Write the contents of a string to a file."""
|
||||
with open(fileName, mode="w", encoding="utf-8") as outFile:
|
||||
outFile.write(fileData)
|
||||
|
||||
|
||||
def cleanProject(path):
|
||||
"""Delete all generated files in a project.
|
||||
"""
|
||||
def cleanProject(path: str | Path):
|
||||
"""Delete all generated files in a project."""
|
||||
path = Path(path)
|
||||
cacheDir = path / "cache"
|
||||
if cacheDir.is_dir():
|
||||
|
||||
Reference in New Issue
Block a user