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

[rqd] Python tests for rqd only v2 #1548

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0c47cf2
Change tests to not use setup.py, but use the unittest module directly
lithorus Oct 18, 2024
9db2eb4
Add tests for rqd using vanilla python and introduce requirements dir…
lithorus Oct 18, 2024
dc19beb
Merge branch 'master' into rqd-python-tests-v2
lithorus Oct 22, 2024
9b1738a
Add pynput to tests.txt
lithorus Oct 23, 2024
f899968
Add script for converting imports in grpc python modules and remove 2to3
lithorus Oct 24, 2024
2090b64
Merge remote-tracking branch 'lithorus/remove-2to3' into rqd-python-t…
lithorus Oct 24, 2024
cc2fec4
Replace 2to3 with convert script and remove 2to3
lithorus Oct 24, 2024
15c8013
Add python 3.13 rqd tests
lithorus Oct 24, 2024
ad902f5
Remove debug prints
lithorus Oct 24, 2024
57a7bdf
Merge remote-tracking branch 'lithorus/remove-2to3' into rqd-python-t…
lithorus Oct 24, 2024
3bed013
Merge branch 'AcademySoftwareFoundation:master' into rqd-python-tests-v2
lithorus Oct 30, 2024
6286e28
Merge branch 'AcademySoftwareFoundation:master' into rqd-python-tests-v2
lithorus Nov 8, 2024
7af9ec3
Switch to using pytest for rqd
lithorus Nov 9, 2024
75996ff
Remove rqd test for python 3.7
lithorus Nov 9, 2024
76c4373
Merge remote-tracking branch 'origin/master' into rqd-python-tests-v2
lithorus Nov 14, 2024
e8e240a
Fix test for python 3.12+ which involves removing a real directory
lithorus Nov 14, 2024
c81334a
Update rqconstants_test.py
lithorus Nov 14, 2024
7ac4d29
Merge branch 'AcademySoftwareFoundation:master' into rqd-python-tests-v2
lithorus Nov 28, 2024
4f87aa8
Add docker as a requirement for rqd
lithorus Nov 28, 2024
1a2344e
Merge branch 'AcademySoftwareFoundation:master' into rqd-python-tests-v2
lithorus Nov 29, 2024
fc55a2f
Merge branch 'master' into rqd-python-tests-v2
DiegoTavares Dec 4, 2024
d578aa4
Merge branch 'AcademySoftwareFoundation:master' into rqd-python-tests-v2
lithorus Dec 4, 2024
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
60 changes: 60 additions & 0 deletions .github/workflows/testing-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,63 @@ jobs:
uses: tj-actions/changed-files@v41
- name: Check for Version Change
run: ci/check_version_bump.py ${{ steps.get_changed_files.outputs.all_changed_and_modified_files }}

test_rqd_python_3_8:
name: Test RQD with python 3.8
runs-on: ubuntu-latest
container:
image: python:3.8
steps:
- uses: actions/checkout@v4
- name: Run Python Tests
run: ci/run_rqd_python_tests.sh

test_rqd_python_3_9:
name: Test RQD with python 3.9
runs-on: ubuntu-latest
container:
image: python:3.9
steps:
- uses: actions/checkout@v4
- name: Run Python Tests
run: ci/run_rqd_python_tests.sh

test_rqd_python_3_10:
name: Test RQD with python 3.10
runs-on: ubuntu-latest
container:
image: python:3.10
steps:
- uses: actions/checkout@v4
- name: Run Python Tests
run: ci/run_rqd_python_tests.sh

test_rqd_python_3_11:
name: Test RQD with python 3.11
runs-on: ubuntu-latest
container:
image: python:3.11
steps:
- uses: actions/checkout@v4
- name: Run Python Tests
run: ci/run_rqd_python_tests.sh

test_rqd_python_3_12:
name: Test RQD with python 3.12
runs-on: ubuntu-latest
container:
image: python:3.12
steps:
- uses: actions/checkout@v4
- name: Run Python Tests
run: ci/run_rqd_python_tests.sh

test_rqd_python_3_13:
name: Test RQD with python 3.13
runs-on: ubuntu-latest
container:
image: python:3.13
steps:
- uses: actions/checkout@v4
- name: Run Python Tests
run: ci/run_rqd_python_tests.sh
26 changes: 26 additions & 0 deletions ci/run_rqd_python_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Script for running OpenCue RQD unit tests with vanilla python
#
# This script is written to be run within the OpenCue GitHub Actions environment.
# See `.github/workflows/testing-pipeline.yml`.

set -e

args=("$@")
python_version=$(python -V 2>&1)
echo "Will run tests using ${python_version}"

pip install --user -r requirements/rqd.txt -r requirements/tests.txt

# Protos need to have their Python code generated in order for tests to pass.
python -m grpc_tools.protoc -I=proto/ --python_out=pycue/opencue/compiled_proto --grpc_python_out=pycue/opencue/compiled_proto proto/*.proto
python -m grpc_tools.protoc -I=proto/ --python_out=rqd/rqd/compiled_proto --grpc_python_out=rqd/rqd/compiled_proto proto/*.proto

# Fix imports to work in both Python 2 and 3. See
# <https://github.com/protocolbuffers/protobuf/issues/1491> for more info.
python ci/fix_compiled_proto.py pycue/opencue/compiled_proto
python ci/fix_compiled_proto.py rqd/rqd/compiled_proto

python -m unittest discover -s pycue/tests -t pycue -p "*.py"
python -m pytest rqd/tests
10 changes: 10 additions & 0 deletions requirements/rqd.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
future==1.0.0
docker==7.1.0
grpcio==1.48.2;python_version<"3.7"
grpcio-tools==1.48.2;python_version<"3.7"
grpcio==1.53.2;python_version>="3.7" and python_version<"3.12"
grpcio-tools==1.53.0;python_version>="3.7" and python_version<"3.12"
grpcio==1.66.2;python_version>="3.12"
grpcio-tools==1.66.2;python_version>="3.12"
PyYAML==5.1
psutil==5.9.8
5 changes: 5 additions & 0 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mock==2.0.0
pyfakefs==3.6;python_version<"3.7"
pyfakefs==5.2.3;python_version>="3.7"
pynput==1.7.6
pytest==8.3.3
2 changes: 1 addition & 1 deletion rqd/tests/rqconstants_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class RqConstantTests(pyfakefs.fake_filesystem_unittest.TestCase):
tempdir = tempfile.mkdtemp()

def setUp(self):
self.setUpPyfakefs()
self.setUpPyfakefs(additional_skip_names=['shutil'])
self.fs.add_real_directory(self.tempdir)
self.fs.create_file("/proc/cpuinfo", contents=CPUINFO)
self.loadavg = self.fs.create_file("/proc/loadavg", contents=LOADAVG_LOW_USAGE)
Expand Down
Loading