Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use terminaltables3, migrate to pyproject.toml #1853

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions MANIFEST.in

This file was deleted.

6 changes: 3 additions & 3 deletions build-artifacts.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/bin/bash -xe

PREV_DIR=`pwd`
PREV_DIR=$(pwd)
cd "$(dirname $0)"

echo "Cleaning environment"
python3 setup.py clean
rm -rf ./build

echo "Building chrome-loader.exe"
rm -f bzt/resources/chrome-loader.exe
x86_64-w64-mingw32-gcc -std=c99 -o bzt/resources/chrome-loader.exe bzt/resources/chrome-loader.c

echo "Creating distribution packages"
rm -rf ./dist
python3 ./setup.py sdist bdist_wheel
python3 -m build

cd "${PREV_DIR}"
2 changes: 1 addition & 1 deletion bzt/engine/dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def replace_infinities(value, key, container):
container[key] = str(container[key])

def _replace_tabs(self, lines, fname):
has_tab_indents = re.compile("^( *)(\t+)( *\S*)")
has_tab_indents = re.compile(r"^( *)(\t+)( *\S*)")
res = ""
for num, line in enumerate(lines):
replaced = has_tab_indents.sub(r"\1" + (" " * self.tab_replacement_spaces) + r"\3", line)
Expand Down
2 changes: 1 addition & 1 deletion bzt/jmx/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from lxml import etree


COUNT_CHECK_CONTENT = """
COUNT_CHECK_CONTENT = r"""
String resp_message = prev.getResponseMessage();
int target_count_min = %s
def match = (resp_message =~ /Received (\d+) of message./);
Expand Down
2 changes: 1 addition & 1 deletion bzt/jmx/rte.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def _handle_input_notation(_input):
text = _input[key]

elif re.match(r'\(.+?\)', key):
label = re.findall("\((.+?)\)", key)[0]
label = re.findall(r"\((.+?)\)", key)[0]
text = _input[key]
return row, col, label, text, tabs

Expand Down
2 changes: 1 addition & 1 deletion bzt/modules/ab.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def __init__(self, config=None, **kwargs):
super(ApacheBenchmark, self).__init__(tool_path=tool_path, installable=False, **kwargs)

def _get_version(self, output):
version = re.findall("Version\s(\S+)\s", output)
version = re.findall(r"Version\s(\S+)\s", output)
if not version:
self.log.warning("%s tool version parsing error: %s", self.tool_name, output)
else:
Expand Down
2 changes: 1 addition & 1 deletion bzt/modules/blazemeter/cloud_provisioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from urllib.error import URLError

import requests
from terminaltables import SingleTable, AsciiTable
from terminaltables3 import SingleTable, AsciiTable
from urwid import Pile, Text

from bzt import AutomatedShutdown, TaurusConfigError, TaurusException, TaurusNetworkError, NormalShutdown
Expand Down
2 changes: 1 addition & 1 deletion bzt/modules/external.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ExternalResultsLoader(ScenarioExecutor, AggregatorListener):
:type reader: bzt.modules.aggregator.ResultsReader
"""
AB_HEADER = "starttime\tseconds\tctime\tdtime\tttime\twait"
PBENCH_FORMAT = re.compile("^[0-9]+\.[0-9]{3}\t[^\t]*\t([0-9]+\t){9}[0-9]+$")
PBENCH_FORMAT = re.compile(r"^[0-9]+\.[0-9]{3}\t[^\t]*\t([0-9]+\t){9}[0-9]+$")

def __init__(self):
super(ExternalResultsLoader, self).__init__()
Expand Down
2 changes: 1 addition & 1 deletion bzt/modules/gatling.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _normalizeContent(self,dynamicExtractor,subject):
@staticmethod
def _safeEscape(subject):
subject = re.escape(subject)
subject = subject.replace("\^","^").replace("\(","(").replace("\)",")").replace("\+","+").replace("\*","*").replace("\.",".").replace("\?","?").replace('"','\\"')
subject = subject.replace(r"\^","^").replace(r"\(","(").replace(r"\)",")").replace(r"\+","+").replace(r"\*","*").replace(r"\.",".").replace(r"\?","?").replace('"','\\"')
return subject

def _get_regex_extractor(self,varname, regexp, match_no,defaults=None):
Expand Down
2 changes: 1 addition & 1 deletion bzt/modules/java/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def __init__(self, **kwargs):
super(JavaC, self).__init__(tool_path="javac", installable=False, **kwargs)

def _get_version(self, output):
versions = re.findall("javac\ ([\d\._]*)", output)
versions = re.findall(r"javac\ ([\d\._]*)", output)
version = parse_java_version(versions)

if not version:
Expand Down
2 changes: 1 addition & 1 deletion bzt/modules/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from collections import Counter, OrderedDict
from datetime import datetime

from terminaltables import AsciiTable
from terminaltables3 import AsciiTable

from bzt import TaurusInternalException, TaurusConfigError
from bzt.engine import Reporter
Expand Down
2 changes: 1 addition & 1 deletion bzt/requests_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from bzt import TaurusConfigError, TaurusInternalException
from bzt.utils import ensure_is_dict, dehumanize_time, BetterDict, parse_think_time

VARIABLE_PATTERN = re.compile("\${.+\}")
VARIABLE_PATTERN = re.compile(r"\${.+\}")


def has_variable_pattern(val):
Expand Down
8 changes: 4 additions & 4 deletions bzt/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ def parse_java_version(versions):
version = versions[0]

if LooseVersion(version) > LooseVersion("6"): # start of openjdk naming
major = re.findall("^([\d]*)", version)
major = re.findall(r"^([\d]*)", version)
else:
major = re.findall("\.([\d]*)", version)
major = re.findall(r"\.([\d]*)", version)

if major:
return major[0]
Expand Down Expand Up @@ -1527,7 +1527,7 @@ def __init__(self, **kwargs):
super(JavaVM, self).__init__(installable=False, tool_path="java", **kwargs)

def _get_version(self, output):
versions = re.findall("version\ \"([_\d\.]*)", output)
versions = re.findall(r"version\ \"([_\d\.]*)", output)
version = parse_java_version(versions)

if not version:
Expand Down Expand Up @@ -1991,7 +1991,7 @@ def get_assembled_value(configs, key, protect=False):

def parse_think_time(think_time, full=False):
distributions = ["uniform", "gaussian", "poisson"]
format_str = "^(%s)\(([\wd.]+)[,\s]+([\wd.]+)\)$"
format_str = r"^(%s)\(([\wd.]+)[,\s]+([\wd.]+)\)$"
expr = re.compile(format_str % '|'.join(distributions), re.IGNORECASE)
res = expr.match(str(think_time))

Expand Down
42 changes: 42 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[project]
name = "bzt"
description = "Taurus Tool for Continuous Testing"
readme = "README.md"
authors = [{ name = "Andrey Pokhilko", email = "[email protected]" }]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Testing :: Traffic Generation",
"License :: OSI Approved :: Apache Software License",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
]
requires-python = ">=3.6" # should be '>=3.7', but let's keep it for obsolete configuration
license = { text = "Apache 2.0" }
dynamic = ["dependencies", "version"]

[project.urls]
Homepage = "http://gettaurus.org/"
Downloads = "http://gettaurus.org/docs/DeveloperGuide/#Python-Egg-Snapshots"

[project.scripts]
bzt = "bzt.cli:main"
jmx2yaml = "bzt.jmx2yaml:main"
soapui2yaml = "bzt.soapui2yaml:main"
swagger2yaml = "bzt.swagger2yaml:main"

[tool.setuptools.dynamic]
version = { attr = "bzt.resources.version.VERSION" }
dependencies = { file = "requirements.txt" }

[tool.setuptools.packages.find]
include = ["bzt*"]

[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pyvirtualdisplay; sys_platform != 'win32'
pyyaml
requests>=2.18.1
urwid==2.1.2
terminaltables>=3.1.0
terminaltables3>=4.0.0
molotov!=2.3
influxdb >= 5.3
python-socketio>=5.8.0
Expand Down
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

70 changes: 0 additions & 70 deletions setup.py

This file was deleted.

2 changes: 1 addition & 1 deletion tests/unit/modules/jmeter/test_JMX.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def test_TST_low_val(self):

def _get_tst_schedule(self):
records = []
shaper_elements = self.jmx.get("kg\.apc\.jmeter\.timers\.VariableThroughputTimer")
shaper_elements = self.jmx.get(r"kg\.apc\.jmeter\.timers\.VariableThroughputTimer")
self.assertEqual(1, len(shaper_elements))

shaper_collection = shaper_elements[0].find(".//collectionProp[@name='load_profile']")
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/modules/jmeter/test_JMeterExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def test_zero_concurrency(self):
self.obj.prepare()
jmx = JMX(self.obj.modified_jmx)
selector = 'jmeterTestPlan>hashTree>hashTree>ThreadGroup'
selector += '>stringProp[name=ThreadGroup\.num_threads]'
selector += r'>stringProp[name=ThreadGroup\.num_threads]'
thr = jmx.get(selector)
self.assertEqual(4, len(thr)) # tg with concurrency=0 must be disabled
self.assertEqual('20', thr[0].text) # 2 -> 20
Expand All @@ -138,7 +138,7 @@ def test_jmx_2tg(self):
self.obj.prepare()
jmx = JMX(self.obj.modified_jmx)
selector = 'jmeterTestPlan>hashTree>hashTree>ThreadGroup'
selector += '>stringProp[name=ThreadGroup\.num_threads]'
selector += r'>stringProp[name=ThreadGroup\.num_threads]'
thr = jmx.get(selector)
self.assertEquals('420', thr[0].text)
self.assertEquals('631', thr[1].text)
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/modules/test_cloudProvisioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -2090,10 +2090,10 @@ def get_kpis(self, min_ts):
return self._extract("GET https://a.blazemeter.com/api/v4/data/kpis")

def get_aggregate_report(self):
return self._extract("GET https://a.blazemeter.com/api/v4/masters/\d+/reports/aggregatereport/data")
return self._extract(r"GET https://a.blazemeter.com/api/v4/masters/\d+/reports/aggregatereport/data")

def get_errors(self):
tpl = "GET https://a.blazemeter.com/api/v4/masters/\d+/reports/errorsreport/data?noDataError=false"
tpl = r"GET https://a.blazemeter.com/api/v4/masters/\d+/reports/errorsreport/data?noDataError=false"
return self._extract(tpl)


Expand Down
2 changes: 1 addition & 1 deletion tests/unit/modules/test_locustIOExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def test_build_script(self):
"body": {'var1': 'val1'},
"assert": [{
'subject': 'body',
'contains': '\w+l1e'}]}]}}})
'contains': r'\w+l1e'}]}]}}})
self.obj_prepare()
self.assertFilesEqual(RESOURCES_DIR + "locust/generated_from_requests.py", self.obj.script)
self.obj.post_process()
Expand Down