- Changed all normal results to ok.
- Normal results were intended for tools that produced info and
weren't expected to have problem results.
- Ultimately not worth distinguishing from tools that sometimes
show problems.
- One less color status makes the summary table simpler.
- Also changed the not-applicable status color to the lighter grey
that normal used to have.
- Made the success status non-configurable since ok status is the
only sensible status at the moment.
41 lines
1.1 KiB
Python
Executable file
41 lines
1.1 KiB
Python
Executable file
#!/usr/bin/env python3.9
|
|
|
|
|
|
import asyncio
|
|
import os
|
|
import shutil
|
|
import tempfile
|
|
import unittest
|
|
|
|
import eris.tools as tools
|
|
import eris.worker as worker
|
|
|
|
|
|
class WorkerTestCase(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
self.temp_dir = tempfile.mkdtemp()
|
|
self.original_working_dir = os.getcwd()
|
|
os.chdir(self.temp_dir)
|
|
os.mkdir(tools.CACHE_PATH)
|
|
open("foo", "w").close()
|
|
|
|
def tearDown(self):
|
|
shutil.rmtree(self.temp_dir)
|
|
os.chdir(self.original_working_dir)
|
|
|
|
def test_run_job(self):
|
|
loop = asyncio.get_event_loop()
|
|
compression = "none"
|
|
worker_ = worker.Worker(False, compression)
|
|
loop.run_until_complete(worker_.create_process())
|
|
worker_.process.stdin.write(f"{compression}\n".encode("utf-8"))
|
|
future = worker_.run_tool("foo", tools.metadata)
|
|
status = loop.run_until_complete(future)
|
|
self.assertEqual(status, tools.Status.ok)
|
|
result_path = os.path.join(tools.CACHE_PATH, "foo-metadata")
|
|
self.assertTrue(os.path.exists(result_path))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|