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

Python 2->3 Conversion. #448

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
bddf8af
Initial Python 2->3 Conversion.
alexanderrichards Jan 31, 2020
4a65186
Convert testing steering file to use Python3
alexanderrichards Jan 31, 2020
fdb419f
Remove strict dependency version requirements to facilitate moving to…
alexanderrichards Feb 3, 2020
3991592
Update Tox ini file.
alexanderrichards Feb 3, 2020
4e54107
Update the email sending in HRService for Python3.
alexanderrichards Feb 3, 2020
f735339
Decode token random bytes for use with URLSafeSerializer.
alexanderrichards Feb 3, 2020
7359d58
Open config for reading in text mode.
alexanderrichards Feb 4, 2020
e7a8548
Fix test_usercommand.py tests.
alexanderrichards Feb 4, 2020
cc1a6e2
Fixing tests in test_DemoService.py
alexanderrichards Feb 4, 2020
f710dbe
Fix tests for test_database.py
alexanderrichards Feb 4, 2020
def76c0
Fix SiteService deprecation warnings of log.warn -> log.warning
alexanderrichards Feb 4, 2020
eb6e6b6
Fix testing errors in test_SiteService.py
alexanderrichards Feb 4, 2020
9d68f37
Fix encoding of password hashing -> Fix test_HRClient.py tests.
alexanderrichards Feb 4, 2020
5ab6358
Fix testing for test_HRService.py
alexanderrichards Feb 4, 2020
35f6a49
Fix testing for test_config.py
alexanderrichards Feb 4, 2020
16079d8
Explicitly define TemporaryFiles as text mode
alexanderrichards Feb 4, 2020
4ac4541
Fix testing for test_hashing.py
alexanderrichards Feb 4, 2020
a544248
Fix testing for test_lockfile.py
alexanderrichards Feb 4, 2020
06510f8
Fix testing for test_myproxy.py
alexanderrichards Feb 4, 2020
94d4bb7
Fix testing for test_WebPageService.py
alexanderrichards Feb 4, 2020
829a54b
Fix testing for test_WorkqueueService.py
alexanderrichards Feb 4, 2020
1564e8e
Fix for Exception().message
alexanderrichards Feb 4, 2020
8e23e8f
Add Popen stdin encoding.
alexanderrichards Feb 4, 2020
3f21108
Decode the received buffer in Worker. Fix test_Worker.py tests.
alexanderrichards Feb 4, 2020
4f8737d
First fix for test_WSGIServer.py tests.
alexanderrichards Feb 4, 2020
4daf592
Fix testing for test_sshkey.py
alexanderrichards Feb 6, 2020
c56a01a
Fix deprecation of assertEquals in test_db.py
alexanderrichards Feb 6, 2020
178d214
Fix deprecation of assertDictContainsSubset in test_WorkqueueService.py
alexanderrichards Feb 6, 2020
768640d
Migrate to unittest.mock
alexanderrichards Feb 6, 2020
6d9dd81
Fix testing for test_WSGIServer.py
alexanderrichards Feb 6, 2020
3b39503
Run testing on CentOS8
alexanderrichards Feb 7, 2020
27a8828
Fix for full test getting X509Name attributes.
alexanderrichards Feb 7, 2020
90e2134
Add service_identity dependency for Twisted.
alexanderrichards Feb 7, 2020
291652c
Fix new WorkqueueService Algorithm tests for Python3
alexanderrichards Feb 11, 2020
970bc90
Upload full testing output as artifacts if tests fail.
alexanderrichards Feb 12, 2020
3409c9e
Fix six dependence for full testing.
alexanderrichards Feb 12, 2020
dfdef6c
Remove unecessary iter() from WorkqueueService.py
alexanderrichards Feb 12, 2020
01bf6a3
Fix Python2-> string encoding
alexanderrichards Feb 16, 2021
ae045ef
Merge pull request #453 from ic-hep/alexanderrichards-patch-1
alexanderrichards Feb 18, 2021
c39d100
Fix the encoding of the myproxy subprocess
alexanderrichards Mar 26, 2021
05afc6a
Fix FlaskWrapper.py
alexanderrichards Mar 26, 2021
f018da7
Fix CI testing
alexanderrichards Mar 26, 2021
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
56 changes: 45 additions & 11 deletions .github/workflows/on_push_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,85 @@ jobs:

lint:
runs-on: ubuntu-latest
container:
image: centos:8
steps:
- uses: actions/checkout@v1
- name: Install EPEL
run: dnf install -y epel-release
- name: Install dependencies
run: sudo apt-get install python python-pip python-virtualenv python-m2crypto
run: dnf install -y python3 python3-m2crypto
- name: Setup virtualenv
run: |
virtualenv --system-site-packages venv
python3 -m venv --system-site-packages venv
(. venv/bin/activate && pip install --upgrade pip wheel setuptools)
- name: Install pdm from push
run: (. venv/bin/activate && pip install --user -e .)
run: (. venv/bin/activate && pip install -e .)
- name: Install Tox and dependencies (for testing)
run: (. venv/bin/activate && pip install tox)
- name: Run tox testing
run: (. venv/bin/activate && tox -e lint test)
run: (. venv/bin/activate && tox -e lint test)
- name: Upload output artifact
if: failure()
uses: actions/upload-artifact@v1
with:
name: lint_output
path: .tox/lint

unit:
runs-on: ubuntu-latest
container:
image: centos:8
steps:
- uses: actions/checkout@v1
- name: Install EPEL
run: dnf install -y epel-release
- name: Install dependencies
run: sudo apt-get install python python-pip python-virtualenv python-m2crypto
run: dnf install -y python3 python3-m2crypto
- name: Setup virtualenv
run: |
virtualenv --system-site-packages venv
python3 -m venv --system-site-packages venv
(. venv/bin/activate && pip install --upgrade pip wheel setuptools)
- name: Install pdm from push
run: (. venv/bin/activate && pip install --user -e .)
run: (. venv/bin/activate && pip install -e .)
- name: Install Tox and dependencies (for testing)
run: (. venv/bin/activate && pip install tox)
- name: Run tox testing
run: (. venv/bin/activate && tox -e unit test)
- name: Upload output artifact
if: failure()
uses: actions/upload-artifact@v1
with:
name: unit_output
path: .tox/unit

full:
runs-on: ubuntu-latest
container:
image: centos:8
steps:
- uses: actions/checkout@v1
- name: Install EPEL
run: dnf install -y epel-release
- name: Install dependencies
run: sudo apt-get install python python-pip python-virtualenv python-m2crypto
run: dnf install -y openssl python3 python3-m2crypto python3-pyOpenSSL
- name: Setup virtualenv
run: |
virtualenv --system-site-packages venv
python3 -m venv --system-site-packages venv
(. venv/bin/activate && pip install --upgrade pip wheel setuptools)
- name: Install pdm from push
run: (. venv/bin/activate && pip install --user -e .)
run: (. venv/bin/activate && pip install -e .)
##Fixes ERROR: virtualenv 20.0.3 has requirement six<2,>=1.12.0, but you'll have six 1.11.0 which is incompatible.
## This virtualenv is used by the tox (3.14.3) system.
## The old version of six must come from the distribution (system-site-package) of python3-pyOpenSSL which is only
## installed for full testing
- name: Install Tox and dependencies (for testing)
run: (. venv/bin/activate && pip install tox)
run: (. venv/bin/activate && pip install 'six>=1.12.0,<2' tox==3.14.3)
- name: Run tox testing
run: (. venv/bin/activate && tox -e full test)
- name: Upload output artifact
if: failure()
uses: actions/upload-artifact@v1
with:
name: full_output
path: .tox/full
30 changes: 15 additions & 15 deletions bin/test_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

def show_turtles(client):
turtles = client.get_turtles()
print "Server Turtles: %s" % ', '.join(turtles.values())
print("Server Turtles: %s" % ', '.join(turtles.values()))

def main():

return_code = 0

if len(sys.argv) != 2:
print "Usage: test_demo.py <conf_file>"
print("Usage: test_demo.py <conf_file>")
sys.exit(1)

# We load a config so that the client can find the server
Expand All @@ -28,50 +28,50 @@ def main():
os.chdir(os.path.dirname(conf_file))
# Create a client and run the hello function
client = DemoClient()
print "Hello Returned: %s" % client.hello().strip()
print("Hello Returned: %s" % client.hello().strip())

# Now do Turtle stuff
show_turtles(client)
print "Adding Turtle..."
print("Adding Turtle...")
my_id = client.add_turtle("New Turtle")['id']
print "New turtle is ID: %u" % my_id
print("New turtle is ID: %u" % my_id)
show_turtles(client)
print "Modifying turtle with ID %u..." % my_id
print("Modifying turtle with ID %u..." % my_id)
mod_turtle = client.modify_turtle(my_id, "My Lovely Turtle")
print "Modified turtle: %s" % mod_turtle
print("Modified turtle: %s" % mod_turtle)
show_turtles(client)

print "Deleting new turtle."""
print("Deleting new turtle.""")
client.del_turtle(my_id)
show_turtles(client)


# Do Token Demo
print "\n\nTOKEN DEMO\n"
print("\n\nTOKEN DEMO\n")
token = client.get('get_token')
print "Got Token: %s" % token
print("Got Token: %s" % token)

# Try a request without a token
try:
res = client.get('verify_token')
print "Tokenless request accepted!!! %s" % res
print("Tokenless request accepted!!! %s" % res)
return_code += 1
except:
print "No token request rejected as expected. :-)"
print("No token request rejected as expected. :-)")

# Try a request with the wrong token
try:
client.set_token('WRONGTOKEN')
res = client.get('verify_token')
print "Invalid token accepted!!! %s" % res
print("Invalid token accepted!!! %s" % res)
return_code += 1
except:
print "Wrong token rejected, as expected. :-)"
print("Wrong token rejected, as expected. :-)")

# Try a request with the correct token
client.set_token(token)
res = client.get('verify_token')
print "Verify real token: %s" % res
print("Verify real token: %s" % res)

sys.exit(return_code)

Expand Down
14 changes: 7 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
package_dir={'': 'src'},
packages=find_packages('src'),
install_requires=['m2crypto',
'flask==0.10.1',
'flask-sqlalchemy==2.0',
'flask',
'flask-sqlalchemy',
'pyOpenSSL', # ==0.13.1 on RHEL7
'requests==2.6.0',
'sqlalchemy==0.9.8',
'twisted==12.1.0',
'enum34==1.0.4',
'python-dateutil==1.5'],
'requests',
'sqlalchemy',
'twisted',
'python-dateutil',
'service_identity'], # See commit notes: Needed by Twisted.
include_package_data=True,
scripts=['src/pdm/bin/pdm'],
)
Expand Down
Loading