def test_errtable(self): """Check if the generated error table is present and complete.""" source = "jpylib/pgetopt.py" errors = y.backquote("sed -n '/^Error/s/ .*//p' " + source) errorset = set(errors.split()) with open(docfile) as f: for line in f: if line.startswith("| Error"): the_error = line.split()[1] # will raise KeyError if the_error is not in the errorset errorset.remove(the_error) self.assertEqual(errorset, set())
def do_command(command, source): """Run command and print it to stdout. Make sure the included text is terminated by a newline. Set the SOURCE environment variable to the file from which the "#include !..." command is currently being processed. This may be a file included by another. """ os.environ["SOURCE"] = source output = y.backquote(command) if output.endswith("\n"): terminate = "" else: terminate = "\n" print(output, end=terminate)
def getdata(self): return json.loads(y.backquote("lib/read-secrets.py"))
def test_isotime(self): # Take care to call isotime() roughly at the start of a second, so # date(1) will not show a different second. time.sleep((1000000 - datetime.datetime.now().microsecond) / 1000000.0) self.assertEqual(y.isotime(), y.backquote("date +%Y%m%d:%H%M%S").strip())
def setUp(self): sizes = y.backquote("stty size < /dev/tty").split() self.rows = int(sizes[0]) self.cols = int(sizes[1])