Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Fix unittest issues
Browse files Browse the repository at this point in the history
  • Loading branch information
xlz-jbleclere committed Feb 18, 2022
1 parent 5047d2f commit f9721e9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
17 changes: 8 additions & 9 deletions tests/test_improve_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,19 @@ def test_improve_coverage_ws_client(accelize_drm, conf_json, cred_json,
conf_json['licensing']['url'] = _request.url + request.function.__name__
conf_json.save()

# Set initial context on the live server
error_code = 600
context = {'error_code':error_code}
set_context(context)
assert get_context() == context

with accelize_drm.DrmManager(
conf_json.path,
cred_json.path,
driver.read_register_callback,
driver.write_register_callback,
async_cb.callback
) as drm_manager:

# Set initial context on the live server
error_code = 600
context = {'error_code':error_code}
set_context(context)
assert get_context() == context

with pytest.raises(accelize_drm.exceptions.DRMWSError) as excinfo:
drm_manager.activate()
assert async_handler.get_error_code(str(excinfo.value)) == accelize_drm.exceptions.DRMWSError.error_code
Expand Down Expand Up @@ -285,7 +284,7 @@ def my_read_register(register_offset, returned_data, ctx):
ret = driver.read_register_callback(register_offset, returned_data)
if ctx['page'] == 5 and register_offset == 4:
ctx['cnt'] += 1
if ctx['cnt'] == 11:
if ctx['cnt'] == 12:
returned_data.contents.value &= 0xFFFF
return ret

Expand Down Expand Up @@ -313,7 +312,7 @@ def my_write_register(register_offset, data_to_write, ctx):


def test_improve_coverage_setLicense(accelize_drm, conf_json, cred_json, async_handler,
live_server, request):
live_server, request):
"""
Improve coverage of the setLicense function
"""
Expand Down
4 changes: 3 additions & 1 deletion tests/test_valgrind.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
from tests.proxy import get_context, set_context


@pytest.mark.nosom
def test_normal_usage(accelize_drm, request, exec_func, live_server, tmpdir,
log_file_factory):
"""Check memory leak with valgrind"""
if 'aws' not in accelize_drm.pytest_fpga_driver_name:
pytest.skip("C unit-tests are only supported with AWS driver.")

if accelize_drm.is_ctrl_sw:
pytest.skip("Test skipped on SoM target: valgrind is not installed")

# Set initial context on the live server
nb_running = 2
healthPeriod = 2
Expand Down
2 changes: 1 addition & 1 deletion tests/unittests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ int test_set_json_string_with_empty_string() {
}

// Test normal usage, especially to run valgrind for memory leak check
int test_normal_usage( string param_file) {
int test_normal_usage( string param_file ) {
int ret = -1;

Json::Value param_json = parseJsonFile(param_file);
Expand Down

0 comments on commit f9721e9

Please sign in to comment.