Skip to content

Commit

Permalink
bugfix: add logs to debug remote test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
roryai committed Jan 9, 2024
1 parent 318fcdd commit ab6c8b3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def init_log_file(self, destination_directory):
suffix = 'media_transfer_logfile.txt'
filename = timestamp + suffix
log_file_path = os.path.join(destination_directory, filename)

print(f'\ndestination_directory in Logger: {destination_directory}')
print(f'\nlogfile_path in Logger: {log_file_path}')
with open(log_file_path, 'w'):
pass

Expand Down
3 changes: 3 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
elif args.destination:
DirectoryManager().check_if_directory_exists(args.source)
DirectoryManager().check_if_directory_exists(args.destination)
print(f'\ndestination_directory in Main: {args.destination}')

Logger().init_log_file(args.destination)

AppController(destination_directory=args.destination,
source_directory=args.source).copy_files_from_source_to_destination()
else:
Expand Down
5 changes: 5 additions & 0 deletions test/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@
destination_root_directory = test_media_directory + 'destination/'

DBInitializer().init_test_database()
print(f'\nlogfile_directory helpers: {logfile_directory}')
print(f'\ntest_directory helpers: {test_directory}')
Logger().init_log_file(logfile_directory)

def plogs():
print(f'\nlogfile_directory plogs: {logfile_directory}')
print(f'\ndestination_root_directory plogs: {destination_root_directory}')

def create_files_with_desired_extensions():
for file_path in valid_source_filepaths():
Expand Down
3 changes: 3 additions & 0 deletions test/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ def test_init_log_file_creates_file():
# assign singleton Logger (created in .helpers) so that it can be deleted and then reinitialised
logger = Logger()
del logger
print(f'\nlogfile_directory in test_logger: {logfile_directory}')

Logger().init_log_file(logfile_directory)
plogs()

assert os.path.exists(Logger().log_file_path)

Expand Down

0 comments on commit ab6c8b3

Please sign in to comment.