Example #1
0
 def test_setup_1(self):
     app_paths = AppDataPaths(home_folder_path=os.getcwd())
     app_paths.clear(everything=True)
     assert app_paths.require_setup is True
     app_paths.setup()
     assert app_paths.require_setup is False
     app_paths.clear(everything=True)
Example #2
0
 def test_lock_1(self):
     app_paths = AppDataPaths(home_folder_path=os.getcwd())
     app_paths.setup(override=True)
     lock = app_paths.lock()
     with lock.context():
         pass
     app_paths.clear(everything=True)
Example #3
0
 def test_lock_2(self):
     app_paths = AppDataPaths(home_folder_path=os.getcwd())
     app_paths.setup(override=True)
     lock = app_paths.lock()
     lock.acquire()
     lock.release()
     app_paths.clear(everything=True)
Example #4
0
 def test_clear_2(self):
     app_paths = AppDataPaths(home_folder_path=os.getcwd())
     app_paths.clear(everything=True)
     assert not os.path.exists(app_paths.app_data_path)
     app_paths.setup()
     assert os.path.exists(app_paths.app_data_path)
     app_paths.clear(everything=True)
     assert not os.path.exists(app_paths.app_data_path)
Example #5
0
 def test_check_for_exceptions_3(self):
     app_paths = AppDataPaths(home_folder_path=os.getcwd())
     app_paths.clear(everything=True)
     try:
         app_paths.check_for_exceptions(raise_exceptions=True)
     except Exception:
         return
     assert False
Example #6
0
 def test_clear_1(self):
     """
     Simple clear clears only default generated files.
     But app data folder and other content stays in place.
     """
     app_paths = AppDataPaths(home_folder_path=os.getcwd())
     app_paths.clear(everything=True)
     assert not os.path.exists(app_paths.app_data_path)
     app_paths.setup()
     assert os.path.exists(app_paths.app_data_path)
     assert os.path.exists(app_paths.logs_path)
     assert os.path.exists(app_paths.config_path)
     assert os.path.exists(app_paths.log_file_path)
     app_paths.clear()
     assert os.path.exists(app_paths.app_data_path)
     assert not os.path.exists(app_paths.logs_path)
     assert not os.path.exists(app_paths.config_path)
     assert not os.path.exists(app_paths.log_file_path)
     app_paths.clear(everything=True)
Example #7
0
 def test_check_for_exceptions_8(self):
     app_paths = AppDataPaths(home_folder_path=os.getcwd())
     app_paths.setup()
     shutil.rmtree(app_paths.locks_path)
     assert not app_paths.check_for_exceptions(raise_exceptions=False)
     app_paths.clear(everything=True)
Example #8
0
 def test_check_for_exceptions_6(self):
     app_paths = AppDataPaths(home_folder_path=os.getcwd())
     app_paths.setup()
     os.remove(app_paths.log_file_path)
     assert not app_paths.check_for_exceptions(raise_exceptions=False)
     app_paths.clear(everything=True)
Example #9
0
 def test_check_for_exceptions_4(self):
     app_paths = AppDataPaths(home_folder_path=os.getcwd())
     app_paths.setup()
     assert app_paths.check_for_exceptions(raise_exceptions=False)
     app_paths.clear(everything=True)
Example #10
0
 def test_check_for_exceptions_1(self):
     app_paths = AppDataPaths(home_folder_path=os.getcwd())
     app_paths.clear(everything=True)
     assert app_paths.check_for_exceptions() is False