Skip to content

Commit

Permalink
feat(doctor): fix timezone in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mzaatar committed Dec 15, 2022
1 parent 58d5708 commit d9fe303
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/algokit/core/doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ProcessResult:


def get_date() -> ProcessResult:
return ProcessResult(format(datetime.now(timezone.utc).astimezone().isoformat()), 0)
return ProcessResult(format(datetime.now(timezone.utc).isoformat()), 0)


def get_algokit_info() -> ProcessResult:
Expand Down
5 changes: 2 additions & 3 deletions tests/doctor/test_doctor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import typing
from datetime import datetime, timezone
from datetime import datetime
from pathlib import Path

import click
Expand Down Expand Up @@ -33,8 +33,7 @@ def mock_dependencies(mocker: MockerFixture) -> None:
mocked_os.version.return_value = "linux_version"
# Mock datetime
mocked_date = mocker.patch("algokit.core.doctor.datetime")
fake_now = datetime(1990, 12, 31, 10, 9, 8, tzinfo=timezone.utc).astimezone()
mocked_date.now.return_value = fake_now
mocked_date.now.return_value = datetime(1990, 12, 31, 10, 9, 8)
# Mock shutil
mocked_shutil = mocker.patch("algokit.core.doctor.shutil")
mocked_shutil.which.return_value = "/Library/Frameworks/Python.framework/Versions/3.11/bin/python3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DEBUG: Running 'pipx --version' in '{current_working_directory}'
DEBUG: Running 'poetry --version' in '{current_working_directory}'
DEBUG: Running 'node -v' in '{current_working_directory}'
DEBUG: Running 'npm -v' in '{current_working_directory}'
Time: 1990-12-31T18:09:08+08:00
Time: 1990-12-31T10:09:08
AlgoKit: None found
Brew: None found
OS: Mac OS X mac_os_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ DEBUG: Running 'node -v' in '{current_working_directory}'
DEBUG: node: v18.12.1
DEBUG: Running 'npm -v' in '{current_working_directory}'
DEBUG: npm: 8.19.2
Time: 1990-12-31T18:09:08+08:00
Time: 1990-12-31T10:09:08
AlgoKit: 1.2.3 /pipx/venvs/algokit
OS: Unix/Linux linux_version
Docker: 20.10.21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DEBUG: Running 'node -v' in '{current_working_directory}'
DEBUG: node: v18.12.1
DEBUG: Running 'npm -v' in '{current_working_directory}'
DEBUG: npm: 8.19.2
Time: 1990-12-31T18:09:08+08:00
Time: 1990-12-31T10:09:08
AlgoKit: 1.2.3 /pipx/venvs/algokit
Brew: 3.6.15
OS: Mac OS X mac_os_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DEBUG: Running 'node -v' in '{current_working_directory}'
DEBUG: node: v18.12.1
DEBUG: Running 'npm -v' in '{current_working_directory}'
DEBUG: npm: 8.19.2
Time: 1990-12-31T18:09:08+08:00
Time: 1990-12-31T10:09:08
AlgoKit: 1.2.3 /pipx/venvs/algokit
Chocolatey: 0.10.15
OS: Windows windows_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DEBUG: Running 'node -v' in '{current_working_directory}'
DEBUG: node: v18.12.1
DEBUG: Running 'npm -v' in '{current_working_directory}'
DEBUG: npm: 8.19.2
Time: 1990-12-31T18:09:08+08:00
Time: 1990-12-31T10:09:08
AlgoKit: 1.2.3 /pipx/venvs/algokit
Brew: 3.6.15
OS: Mac OS X mac_os_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DEBUG: Running 'node -v' in '{current_working_directory}'
DEBUG: node: v18.12.1
DEBUG: Running 'npm -v' in '{current_working_directory}'
DEBUG: npm: 8.19.2
Time: 1990-12-31T18:09:08+08:00
Time: 1990-12-31T10:09:08
AlgoKit: 1.2.3 /pipx/venvs/algokit
Brew: 3.6.15
OS: Mac OS X mac_os_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ DEBUG: Running 'node -v' in '{current_working_directory}'
DEBUG: node: v18.12.1
DEBUG: Running 'npm -v' in '{current_working_directory}'
DEBUG: npm: 8.19.2
Time: 1990-12-31T18:09:08+08:00
Time: 1990-12-31T10:09:08
AlgoKit: 1.2.3 /pipx/venvs/algokit
Brew: 3.6.15
OS: Mac OS X mac_os_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DEBUG: Running 'node -v' in '{current_working_directory}'
DEBUG: node: v18.12.1
DEBUG: Running 'npm -v' in '{current_working_directory}'
DEBUG: npm: 8.19.2
Time: 1990-12-31T18:09:08+08:00
Time: 1990-12-31T10:09:08
AlgoKit: 1.2.3 /pipx/venvs/algokit
Chocolatey: 0.10.15
OS: Windows windows_version
Expand Down

0 comments on commit d9fe303

Please sign in to comment.