Skip to content

Commit

Permalink
Tests: Activated stderr and fixed program exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
havbon authored and bagder committed Apr 16, 2023
1 parent 6279e3d commit 6694470
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import shlex
from dataclasses import dataclass, asdict

IGNORESTDERR = True
TESTFILE = "./tests.json"
if sys.platform == "win32" or sys.platform == "cygwin":
BASECMD = "./trurl.exe" # windows
Expand Down Expand Up @@ -64,9 +63,6 @@ def runCommand(self, stdinkeyword: str):
# assume stderr is always going to be string
stderr = output.stderr.decode().strip()

if (IGNORESTDERR):
self.expected.pop("stderr")

self.commandOutput = CommandOutput(stdout, output.returncode, stderr)
return True

Expand Down Expand Up @@ -137,8 +133,13 @@ def main():
test.printVerbose()

# finally print the results to terminal

run = print
if (numTestsPassed != len(testIndexesToRun)):
run = sys.exit

print("finished:")
print(f"{numTestsPassed}/{len(testIndexesToRun)} tests passed")
run(f"{numTestsPassed}/{len(testIndexesToRun)} tests passed")


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"cmdline": "",
"expected": {
"stdout": "",
"stderr": "",
"stderr": "trurl error: not enough input for a URL\ntrurl error: Try trurl -h for help",
"returncode": 7
}
},
Expand Down

0 comments on commit 6694470

Please sign in to comment.