diff --git a/test_synctime.py b/test_synctime.py index 78d1356..525615c 100755 --- a/test_synctime.py +++ b/test_synctime.py @@ -6,6 +6,7 @@ from dotenv import load_dotenv +import datetime as dt import synctime import test_utils @@ -43,6 +44,22 @@ def test_redmine_times(self): self.redmine.remove_ticket(ticket.id) + def test_redmine_isoformat(self): + date_str = "2024-03-14T17:45:11Z" + date = synctime.parse_str(date_str) + self.assertIsNotNone(date) + self.assertEqual(2024, date.year) + self.assertEqual(3, date.month) + self.assertEqual(14, date.day) + + date2 = dt.datetime.fromisoformat(date_str) + self.assertIsNotNone(date2) + self.assertEqual(2024, date2.year) + self.assertEqual(3, date2.month) + self.assertEqual(14, date2.day) + + + if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG, format="{asctime} {levelname:<8s} {name:<16} {message}", style='{') diff --git a/threader_job.sh b/threader_job.sh index 0ea745f..f973ba3 100755 --- a/threader_job.sh +++ b/threader_job.sh @@ -11,16 +11,15 @@ # */5 * * * * /home/scn/github/netbot/threader_job.sh | /usr/bin/logger -t threader -name=$(basename "$0") project_dir="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" cd "$project_dir" || exit 1 -env="venv" -PYTHON="$project_dir/venv/bin/python3" +VENV=.venv +PYTHON="$project_dir/$VENV/bin/python3" if [ ! -x "$PYTHON" ]; then - echo Building $env - python3 -m venv venv + echo Building $VENV + python3.11 -m venv $VENV $PYTHON -m pip install --upgrade pip $PYTHON -m pip install -r requirements.txt fi