def setUp(self): app.logger.setLevel("DEBUG") self.runner = app.test_cli_runner() self.tempdirobj = tempfile.TemporaryDirectory( prefix="test_prepare_cli_tmpdir", dir=".") self.tempdir = self.tempdirobj.name # Alternative tempdir code keeps it after running, for manual inspection: # self.tempdir = tempfile.mkdtemp(prefix="test_prepare_cli_tmpdir", dir=".") # print('tmpdir={}'.format(self.tempdir)) self.empty_file = os.path.join(self.tempdir, "empty.txt") with io.open(self.empty_file, "wb") as f: pass
def setUp(self): """Create a temporary directory, self.tempdir, and a test runner, self.runner""" app.logger.setLevel("DEBUG") self.runner = app.test_cli_runner() tempdir_prefix = f"tmpdir_{type(self).__name__}_" if not self.keep_temp_dir_after_running: self.tempdirobj = tempfile.TemporaryDirectory( prefix=tempdir_prefix, dir=".") self.tempdir = self.tempdirobj.name else: # Alternative tempdir code keeps it after running, for manual inspection: self.tempdir = tempfile.mkdtemp(prefix=tempdir_prefix, dir=".") print("tmpdir={}".format(self.tempdir))
def setUp(self): app.logger.setLevel("DEBUG") self.runner = app.test_cli_runner() self.tempdirobj = tempfile.TemporaryDirectory( prefix="test_tokenize_cli_tmpdir", dir=".") self.tempdir = self.tempdirobj.name # Alternative tempdir code keeps it after running, for manual inspection: # self.tempdir = tempfile.mkdtemp(prefix="test_tokenize_cli_tmpdir", dir=".") # print('tmpdir={}'.format(self.tempdir)) self.xmlfile = os.path.join(self.tempdir, "fra.xml") _ = self.runner.invoke(prepare, [ "-l", "fra", os.path.join(self.data_dir, "fra.txt"), self.xmlfile ])
def setUp(self): app.logger.setLevel("DEBUG") self.runner = app.test_cli_runner()