Skip to content

Commit

Permalink
Merge pull request nasa#57 from nasa/14-update-pytests-to-run-under-p…
Browse files Browse the repository at this point in the history
…ython-311

14 update pytests to run under python 3.11.2 locally and in CI
  • Loading branch information
Evana13G authored Oct 11, 2023
2 parents 74e5f30 + 30be616 commit d36a1ef
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
python-version: 3.11.2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ test-onair:
image: aetd-dockerlab.gsfc.nasa.gov/spar-lab/onair/onair-meta
stage: test
script:
- python3.9 -m pip install -r requirements_pip.txt
- python3.11 -m pip install -r requirements_pip.txt
- pwd
- python3.9 driver.py -t
- python3.11 driver.py -t
- coverage report
- coverage xml
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
Expand Down
4 changes: 2 additions & 2 deletions test/onair/data_handling/test_redis_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_redis_adapter_DataSource_fails_to_connect_to_server(mocker):
# subscribe_message tests
def test_redis_adapter_DataSource_subscribe_subscribes_to_each_given_subscription_and_starts_listening_when_server_available(mocker):
# Arrange
arg_subscriptions = [MagicMock()] * pytest.gen.randint(0, 10) # 0 to 10 arbitrary
arg_subscriptions = [MagicMock()] * pytest.gen.randint(1, 10) # 1 to 10 arbitrary

fake_server = MagicMock()
fake_pubsub = MagicMock()
Expand Down Expand Up @@ -362,7 +362,7 @@ def test_redis_adapter_DataSource_message_listener_loads_message_info_when_recei

num_fake_data = pytest.gen.randint(1,10)
for i in range(num_fake_data):
fake_data_header = str(MagicMock())
fake_data_header = str(i)
fake_data_value = MagicMock()
fake_data[fake_data_header] = fake_data_value
expected_data_headers.append(fake_data_header)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_DataDrivenLearning__init__sets_instance_ai_constructs_to_a_list_of_the_
arg_headers.append(MagicMock())
num_fake_ai_plugins = pytest.gen.randint(1, 10) # arbitrary, from 1 to 10 (0 has own test)
for i in range(num_fake_ai_plugins):
arg__ai_plugins[str(MagicMock())] = str(MagicMock())
arg__ai_plugins[str(i)] = str(MagicMock())
fake_spec_list.append(MagicMock())
fake_module_list.append(MagicMock())

Expand Down
2 changes: 1 addition & 1 deletion test/onair/utils/test_tlm_json_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def test_tlm_json_converter_mergeDicts_when_args_contain_shared_keys(mocker):
for i in range(len(base_dicts)):
dict_len = pytest.gen.randint(0, 10) # arbitrary, from 0 to 10
for j in range(dict_len):
key, value = str(MagicMock()), str(MagicMock())
key, value = (str(i) + str(j)), pytest.gen.randint(0,1000) # arbitrary, 0 to 1000
base_dicts[i][key] = value
merged_dict[key] = value

Expand Down

0 comments on commit d36a1ef

Please sign in to comment.