diff options
| author | 2022-06-07 10:20:31 -0700 | |
|---|---|---|
| committer | 2022-06-07 10:20:31 -0700 | |
| commit | 308385c2b1348f7aaa271ef1785a9d8a3fb03715 (patch) | |
| tree | 73147c3af7ecb1d4cfb56236ca8e5b8bb421a28d /tests/test_nsjail.py | |
| parent | Test NsJail args are set and used when passed to __init__ (diff) | |
Use new NsJail instance for each test in NsJailArgsTests
Diffstat (limited to '')
| -rw-r--r-- | tests/test_nsjail.py | 23 | 
1 files changed, 11 insertions, 12 deletions
| diff --git a/tests/test_nsjail.py b/tests/test_nsjail.py index 745c44f..492c2f9 100644 --- a/tests/test_nsjail.py +++ b/tests/test_nsjail.py @@ -285,18 +285,17 @@ class NsJailTests(unittest.TestCase):  class NsJailArgsTests(unittest.TestCase): -    @classmethod -    def setUpClass(cls): -        cls._temp_dir = tempfile.TemporaryDirectory() -        cls.addClassCleanup(cls._temp_dir.cleanup) - -        cls.nsjail_path = shutil.copy2("/usr/sbin/nsjail", cls._temp_dir.name) -        cls.config_path = shutil.copy2("./config/snekbox.cfg", cls._temp_dir.name) -        cls.max_output_size = 1_234_567 -        cls.read_chunk_size = 12_345 - -        cls.nsjail = NsJail( -            cls.nsjail_path, cls.config_path, cls.max_output_size, cls.read_chunk_size +    def setUp(self): +        self._temp_dir = tempfile.TemporaryDirectory() +        self.addClassCleanup(self._temp_dir.cleanup) + +        self.nsjail_path = shutil.copy2("/usr/sbin/nsjail", self._temp_dir.name) +        self.config_path = shutil.copy2("./config/snekbox.cfg", self._temp_dir.name) +        self.max_output_size = 1_234_567 +        self.read_chunk_size = 12_345 + +        self.nsjail = NsJail( +            self.nsjail_path, self.config_path, self.max_output_size, self.read_chunk_size          )          logging.getLogger("snekbox.nsjail").setLevel(logging.WARNING) | 
