def write_log(self, buff, str_template, *args): if args: buff.write(u(str_template % args)) buff.write(u("\n")) else: buff.write(u(str_template)) buff.write(u("\n"))
def info(self, str_template, *args): if args: self.info_buf.write(six.u(str_template % args)) self.info_buf.write(six.u("\n")) else: self.info_buf.write(six.u(str_template)) self.info_buf.write(six.u("\n"))
def test_env_type(self): obj = self.getGatling() script = "LocalBasicSimulation.scala" obj.execution.merge({"concurrency": 2, "scenario": {"script": __dir__() + "/../gatling/" + script}}) obj.prepare() obj.engine.artifacts_dir = u(obj.engine.artifacts_dir) obj.startup()
def test_unicode(self): obj = Configuration() expected = six.u("Юникод") obj.merge({ "ustr": expected, }) ustr = obj.get("ustr", "nope") self.assertEqual(ustr, expected)
def test_save(self): obj = Configuration() obj.merge({"str": "text", "uc": six.u("ucstring")}) fname = tempfile.mkstemp()[1] obj.dump(fname, Configuration.YAML) with open(fname) as fh: written = fh.read() logging.debug("YAML:\n%s", written) self.assertNotIn("unicode", written)
def test_save(self): obj = Configuration() obj.merge({ "str": "text", "uc": six.u("ucstring") }) fname = tempfile.mkstemp()[1] obj.dump(fname, Configuration.YAML) with open(fname) as fh: written = fh.read() ROOT_LOGGER.debug("YAML:\n%s", written) self.assertNotIn("unicode", written)
def test_warning_for_throughput_without_duration(self): script = "LocalBasicSimulation.scala" self.configure({"execution": { "concurrency": 2, "throughput": 100, "scenario": {"script": RESOURCES_DIR + "gatling/" + script}}}) self.obj.prepare() self.obj.engine.artifacts_dir = u(self.obj.engine.artifacts_dir) self.obj.startup() self.obj.shutdown() with open(self.obj.stdout.name) as fds: lines = fds.readlines() self.assertNotIn('throughput', lines[-1])
def test_warning_for_throughput_without_duration(self): script = "LocalBasicSimulation.scala" self.obj.execution.merge({ "concurrency": 2, "throughput": 100, "scenario": {"script": RESOURCES_DIR + "gatling/" + script}}) self.obj.prepare() self.obj.engine.artifacts_dir = u(self.obj.engine.artifacts_dir) self.obj.startup() self.obj.shutdown() with open(self.obj.stdout_file.name) as fds: lines = fds.readlines() self.assertNotIn('throughput', lines[-1])
def test_warning_for_throughput_without_duration(self): obj = self.getGatling() script = "LocalBasicSimulation.scala" obj.execution.merge({ "concurrency": 2, "throughput": 100, "scenario": {"script": __dir__() + "/../resources/gatling/" + script}}) obj.prepare() obj.engine.artifacts_dir = u(obj.engine.artifacts_dir) obj.startup() obj.shutdown() with open(obj.stdout_file.name) as fds: lines = fds.readlines() self.assertNotIn('throughput', lines[-1])
def test_env_type(self): script = "LocalBasicSimulation.scala" self.obj.execution.merge({ "concurrency": 2, "hold-for": 1000, "throughput": 100, "scenario": {"script": RESOURCES_DIR + "gatling/" + script}}) self.obj.prepare() self.obj.engine.artifacts_dir = u(self.obj.engine.artifacts_dir) self.obj.startup() self.obj.shutdown() with open(self.obj.stdout_file.name) as fds: lines = fds.readlines() self.assertIn('throughput', lines[-1])
def write_log(self, buff, str_template, args): str_template += "\n" if args: buff.write(u(str_template % args)) else: buff.write(u(str_template))
def test_reader_unicode(self): reader = JTLReader(RESOURCES_DIR + "/jmeter/jtl/unicode.jtl", logging.getLogger(''), None) reader.ignored_labels = [u("Тест.Эхо")] for point in reader.datapoints(): cumulative = point[DataPoint.CUMULATIVE] self.assertNotIn("Тест.Эхо", cumulative)