1111from _validate import (
1212 createJson ,
1313 addonManifest ,
14- manifestLoader
14+ manifestLoader ,
1515)
1616
1717TOP_DIR = os .path .abspath (os .path .dirname (__file__ ))
1818SOURCE_DIR = os .path .dirname (TOP_DIR )
19- INPUT_DATA_PATH = os .path .join (SOURCE_DIR , ' _tests' , ' testData' )
19+ INPUT_DATA_PATH = os .path .join (SOURCE_DIR , " _tests" , " testData" )
2020VALID_JSON = os .path .join (
2121 INPUT_DATA_PATH ,
2222 "addons" ,
2323 "fake" ,
24- "13.0.0.json"
24+ "13.0.0.json" ,
2525) # json file available in testData/fake
26- ADDON_PACKAGE = os .path .join (INPUT_DATA_PATH , ' fake.nvda-addon' )
27- MANIFEST_FILE = os .path .join (INPUT_DATA_PATH , ' manifest.ini' )
26+ ADDON_PACKAGE = os .path .join (INPUT_DATA_PATH , " fake.nvda-addon" )
27+ MANIFEST_FILE = os .path .join (INPUT_DATA_PATH , " manifest.ini" )
2828ADDON_CHANNEL = "testChannel"
2929ADDON_PUBLISHER = "testPublisher"
3030ADDON_SOURCE_URL = "https://example.com/"
3131
32- OUTPUT_DATA_PATH = os .path .join (SOURCE_DIR , ' _tests' , ' testOutput' )
32+ OUTPUT_DATA_PATH = os .path .join (SOURCE_DIR , " _tests" , " testOutput" )
3333
3434
3535def getAddonManifest ():
@@ -39,10 +39,11 @@ def getAddonManifest():
3939
4040
4141class IntegrationTestCreateJson (unittest .TestCase ):
42- """ Integration tests.
42+ """Integration tests.
4343 - The JSON file is created (written to the filesystem).
4444 - The output is then loaded and checked for correctness.
4545 """
46+
4647 def setUp (self ):
4748 self .outputDir = os .path .join (OUTPUT_DATA_PATH , "createJsonOutput" )
4849 self .maxDiff = None # Permit unittest.TestCase (base class) to calculate diffs of any lengths.
@@ -68,12 +69,11 @@ def test_contentsMatchesExampleFile(self):
6869 actualJsonPath = os .path .join (self .outputDir , "fake" , "13.0.0.json" )
6970 self .assertTrue (
7071 os .path .isfile (actualJsonPath ),
71- f"Failed to create json file: { actualJsonPath } "
72+ f"Failed to create json file: { actualJsonPath } " ,
7273 )
7374 self ._assertJsonFilesEqual (actualJsonPath = actualJsonPath , expectedJsonPath = VALID_JSON )
7475
7576 def _assertJsonFilesEqual (self , actualJsonPath : str , expectedJsonPath : str ):
76-
7777 # Not equal, how are they different?
7878 with open (VALID_JSON , encoding = "utf-8" ) as expectedFile :
7979 expectedJson = json .load (expectedFile )
@@ -99,17 +99,17 @@ def test_validVersion(self):
9999 "major" : 1 ,
100100 "minor" : 2 ,
101101 "patch" : 0 ,
102- }
102+ },
103103 },
104- parentDir = self .outputDir
104+ parentDir = self .outputDir ,
105105 )
106106
107107 dir , filename = os .path .split (outputFilePath )
108108 self .assertTrue (os .path .isdir (dir ), msg = "Directory must exist." )
109109 self .assertEqual (
110110 filename ,
111111 "1.2.0.json" ,
112- msg = "Name of the output file should be named based on version number"
112+ msg = "Name of the output file should be named based on version number" ,
113113 )
114114
115115
0 commit comments