Skip to content

Commit

Permalink
Stop testing logfile
Browse files Browse the repository at this point in the history
Depends too much on the platform / Python version
  • Loading branch information
qsantos committed May 14, 2024
1 parent 88c064d commit 93de403
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 74 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
*.o
*.obj
*.zip
test.log
*.pyc
56 changes: 0 additions & 56 deletions expected.log

This file was deleted.

19 changes: 2 additions & 17 deletions tester.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import filecmp
from math import isclose
from os import environ, remove
from os import environ
from socket import create_connection
from subprocess import Popen, PIPE
from sys import executable
Expand All @@ -11,18 +10,11 @@

COMMAND = ["./timeskew.exe", executable, "testee.py"]
TOLERANCE = 0.1
LOGFILE = "test.log"
EXPECTED = "expected.log"
PORT = 40000
print(f'{SLEEP_DURATION=}')
print(f'{TOLERANCE=}')

try:
remove(LOGFILE)
except FileNotFoundError:
pass
environ["TIMESKEW_LOGFILE"] = LOGFILE


def run_testee_with_env(**env: str) -> Popen:
return Popen(COMMAND, stdin=PIPE, stdout=PIPE, env={**env, **environ})
Expand Down Expand Up @@ -67,11 +59,4 @@ def test_relative_time(p: Popen, time_ratio: float) -> None:
sleep(.1)
with create_connection(('127.0.0.1', PORT)) as sock:
sock.sendall(b"1 10\n")
test_relative_time(p, .1)

if not filecmp.cmp(LOGFILE, EXPECTED):
print('The logfile contains:')
print('=' * 50)
with open(LOGFILE) as f:
print(f.read())
print('=' * 50)
test_relative_time(p, .1)

0 comments on commit 93de403

Please sign in to comment.