def testQgsLocalizedDataPathRegistry(self): self.assertEqual( QgsApplication.localizedDataPathRegistry().localizedPath( ABSOLUTE_PATH), MAP_PATH) self.assertEqual( QgsApplication.localizedDataPathRegistry().globalPath(MAP_PATH), ABSOLUTE_PATH)
def testOrderOfPreference(self): os.mkdir('{}/data'.format(self.temp_path)) alt_dir = '{}/{}'.format(self.temp_path, MAP_PATH) Path(alt_dir).touch() QgsApplication.localizedDataPathRegistry().registerPath( self.temp_path, 0) self.assertEqual( QDir.toNativeSeparators( QgsApplication.localizedDataPathRegistry().globalPath( MAP_PATH)), QDir.toNativeSeparators(alt_dir)) QgsApplication.localizedDataPathRegistry().unregisterPath( self.temp_path)
def tearDown(self): QgsApplication.localizedDataPathRegistry().unregisterPath(BASE_PATH)
def setUp(self): QgsApplication.localizedDataPathRegistry().registerPath(BASE_PATH)