Skip to content

Commit

Permalink
[ODS-2866] Update Performance Testing Framework's Python (#14)
Browse files Browse the repository at this point in the history
* Modified install script to install python 3.6

* Modified install script to install python 3.6

* python 3.6 upgrade

* Updated Performance Testing Framework's

* markupsafe upgrade

Co-authored-by: Thomas Nunnery <[email protected]>
  • Loading branch information
vimayya and tnunnerydl authored Jul 2, 2021
1 parent 92a7c2d commit e65c0ee
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 27 deletions.
12 changes: 6 additions & 6 deletions Administration/install-test-runner-prerequisites.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
# See the LICENSE and NOTICES files in the project root for more information.

# Run this script as an administrator to install Chocolatey, Python 2.7.15,
# Run this script as an administrator to install Chocolatey, Python 3.6.7,
# and to set up the performance test runner's Python "virtual environment".
# This script should be run should be run once for environments that do not
# already have these prerequisites set up.
Expand All @@ -19,19 +19,19 @@ if (! (Get-Command choco.exe -ErrorAction SilentlyContinue )) {
refreshenv
}

# Install Python 2.7.15
# Note: This places both c:\Python27 and c:\Python27\Scripts into the system PATH variable.
# Install Python 3.6.7
# Note: This places both c:\Python36 and c:\Python36\Scripts into the system PATH variable.
$pyversion = cmd /c python --version '2>&1'
if ($pyversion -ne "Python 2.7.15") {
choco install python2 -y --version 2.7.15 --params '"/InstallDir:C:\Python27"'
if ($pyversion -ne "Python 3.6.7") {
choco install python3 -y --version 3.6.7 --params '"/InstallDir:C:\Python36"'
refreshenv
}

# Ensure pip is on the latest version
python -m pip install --upgrade pip

# Install virtualenv
pip install virtualenv
pip3 install virtualenv

# "Prepare a Virtual Environment for Python Test Execution"
$virtualdir="c:\virtualenv"
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ and sets up all prerequisites. **Run this script in an Administrator PowerShell
prompt.** The script installs and sets up the following:

* Chocolately, the Windows package installer
* Python 2.7.15
* Python 3.6.7
* Python's 'virtualenv' sandboxing tool
* Creates an EDFI_PERFORMANCE virtual environment (which will contain all of the
installed python dependencies for this project; located at `C:\virtualenv`)
Expand Down
2 changes: 1 addition & 1 deletion edfi_performance/api/basic_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def is_not_expected_result(response, expected_responses):
message = json.loads(response.text)['message']
except Exception:
pass
print response.request.method + " " + str(response.status_code) + ' : ' + message
print (response.request.method + " " + str(response.status_code) + ' : ' + message)
return True
return False

Expand Down
6 changes: 3 additions & 3 deletions edfi_performance/api/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __init__(self, host, token=None):
EdFiAPIClient.token = token

for subclient_class, options in self.dependencies.items():
if isinstance(subclient_class, basestring):
if isinstance(subclient_class, str):
subclient_class = _import_from_dotted_path(subclient_class)
subclient_name = options.get('client_name')
if subclient_name is None:
Expand Down Expand Up @@ -343,7 +343,7 @@ def delete_with_dependencies(self, reference, **kwargs):

def _get_dependency_client(self):
subclient_class, client_name = self.dependencies.items()[0]
if isinstance(subclient_class, basestring):
if isinstance(subclient_class, str):
subclient_class = _import_from_dotted_path(subclient_class)
subclient_name = client_name.get('client_name')
if subclient_name is None:
Expand Down Expand Up @@ -371,7 +371,7 @@ def is_not_expected_result(response, expected_responses):
message = json.loads(response.text)['message']
except Exception:
pass
print response.request.method + " " + str(response.status_code) + ' : ' + message
print (response.request.method + " " + str(response.status_code) + ' : ' + message)
return True
return False

Expand Down
2 changes: 1 addition & 1 deletion edfi_performance/factories/descriptors/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def _build_descriptor_dicts(descriptor_type, values):
descriptor_type = _normalize_descriptor_type(descriptor_type)
key = _descriptor_type_to_dict_key(descriptor_type)
for str_or_iterable in values:
if isinstance(str_or_iterable, basestring):
if isinstance(str_or_iterable, str):
value = str_or_iterable
defaults = {}
else:
Expand Down
2 changes: 1 addition & 1 deletion edfi_performance/factories/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class RandomSuffixAttribute(factory.LazyAttribute):
docstring for `UniqueIdAttribute` above.)
"""
def __init__(self, func, *args, **kwargs):
if isinstance(func, basestring):
if isinstance(func, str):
unformatted_string = str(func)
func = lambda o: unformatted_string
self._suffix_length = kwargs.pop('suffix_length', 4)
Expand Down
8 changes: 4 additions & 4 deletions edfi_performance/tasks/change_query/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _iterate_through_resource_table(self):

while True:
if offset > 0 and offset % 10000 == 0:
print 'Offset has reached: {}'.format(offset)
print ('Offset has reached: {}'.format(offset))
query = "?offset={}&limit={}&minChangeVersion={}".format(offset, limit, min_change_version)
start = timeit.default_timer()
endpoint = self.endpoint
Expand All @@ -72,8 +72,8 @@ def _iterate_through_resource_table(self):
break
offset += limit

print '{} Sync: {} seconds'.format(endpoint, time)
print '{} results returned for {}'.format(num_of_results, endpoint)
print ('{} Sync: {} seconds'.format(endpoint, time))
print ('{} results returned for {}'.format(num_of_results, endpoint))

def _touch_get_list_endpoint(self, endpoint, query):
return self._client.get_list(endpoint, query)
Expand Down Expand Up @@ -120,7 +120,7 @@ def _update_newest_change_version(self):
if available_change_versions is not None:
newest_change_version = available_change_versions['NewestChangeVersion']
set_change_version_value(newest_change_version)
print 'Current value of NewestChangeVersion: {}'.format(newest_change_version)
print ('Current value of NewestChangeVersion: {}'.format(newest_change_version))

@task
def finish_change_query_test_run(self):
Expand Down
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
astroid==1.6.5
atomicwrites==1.2.1
atomicwrites==1.4.0
attrs==18.2.0
autopep8==1.4
backports.functools-lru-cache==1.5
Expand All @@ -14,32 +14,32 @@ factory-boy==2.11.1
Faker==0.8.17
Flask==1.0.2
funcsigs==1.0.2
futures==3.2.0
futures==3.1.1
gevent==1.3.5
greenlet==0.4.14
idna==2.7
ipaddress==1.0.22
isort==4.3.4
itsdangerous==0.24
Jinja2==2.10
Jinja2==2.11.3
lazy-object-proxy==1.3.1
locustio==0.9.0
MarkupSafe==1.0
MarkupSafe==2.0.1
mccabe==0.6.1
more-itertools==4.3.0
msgpack==0.5.6
pathlib2==2.3.2
pbr==5.1.1
pluggy==0.8.0
py==1.7.0
py==1.10.0
pycodestyle==2.4.0
pycparser==2.18
pylint==1.9.2
pytest==3.9.1
pytest-pylint==0.13.0
python-dateutil==2.7.3
pyzmq==17.1.0
requests==2.19.1
requests==2.20.0
scandir==1.9.0
singledispatch==3.4.0.3
six==1.11.0
Expand Down
2 changes: 1 addition & 1 deletion run-tests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ call C:\virtualenv\EDFI_PERFORMANCE\Scripts\activate.bat
REM Install test suite dependencies.
SET PYTHONWARNINGS=ignore:DEPRECATION
python -m pip install --upgrade pip
pip install -r requirements.txt
pip3 install -r requirements.txt

REM Launch the test run.
powershell -NoProfile -ExecutionPolicy Bypass -Command ". .\TestRunner.ps1; Invoke-%1Tests"
Expand Down
6 changes: 3 additions & 3 deletions utility/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ def main(argv):
fileName = Generator.build_file_name(['tasks', 'volume'], resource)
Generator.write_file(volume, fileName)

print 'Boilerplate files have been written. Don\'t forget to review them carefully:'
print Generator.files_created(resource)
print ('Boilerplate files have been written. Don\'t forget to review them carefully:')
print (Generator.files_created(resource))


def _display_help():
print """
"""
Code generator for creating boilerplate files to execute performance tests on a
new resource - including extensions. Version {version}.
Expand Down
Binary file modified utility/requirements.txt
Binary file not shown.

0 comments on commit e65c0ee

Please sign in to comment.