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

tests: nightly: Fix and add more tests #84

Merged
merged 3 commits into from
Feb 28, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
tests: Rename test to better reflect its purpose
The test_location.py test was renamed to test_sampling.py to better
reflect its purpose.

Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
simensrostad committed Feb 28, 2025
commit 0086742994681fbc84ee3b31678137b2d8ad41bf
2 changes: 1 addition & 1 deletion tests/on_target/README.md
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ Run desired tests, example commands
```shell
pytest -s -v -m "not slow" tests
pytest -s -v -m "not slow" tests/test_functional/test_uart_output.py
pytest -s -v -m "not slow" tests/test_functional/test_location.py::test_wifi_location
pytest -s -v -m "not slow" tests/test_functional/test_sampling.py
pytest -s -v -m "slow" tests/test_functional/test_fota.py::test_full_mfw_fota
```

Original file line number Diff line number Diff line change
@@ -14,20 +14,7 @@

logger = get_logger()

def test_wifi_location(t91x_board, hex_file):
'''
Test that the device can get location using Wi-Fi
'''
run_location(t91x_board, hex_file, location_method="Wi-Fi")

@pytest.mark.skip(reason="GNSS location is not supported on this device")
def test_gnss_location(t91x_board, hex_file):
'''
Test that the device can get location using GNSS
'''
run_location(t91x_board, hex_file, location_method="GNSS")

def run_location(t91x_board, hex_file, location_method):
def test_sampling(t91x_board, hex_file):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The refactoring of the test function from location-specific tests to a more general sampling test is appropriate given the changes in the location library. However, ensure that the new test adequately covers all necessary functionality previously tested.

flash_device(os.path.abspath(hex_file))
t91x_board.uart.xfactoryreset()
patterns_cloud_connection = [
@@ -64,6 +51,3 @@ def run_location(t91x_board, hex_file, location_method):
assert values
lat, lon, acc, method = values
assert abs(float(lat) - 61.5) < 2 and abs(float(lon) - 10.5) < 1
method = int(method)
expected_method = 4 if location_method == "Wi-Fi" else 1
assert method == expected_method