From 9a6fa8337674f2c26ed67d4a87be1a9ea60d572e Mon Sep 17 00:00:00 2001 From: Veiko Aasa Date: Tue, 15 Dec 2020 14:43:23 +0200 Subject: [PATCH] gitweb: Make functional tests compatible with pytest-bdd v4.0 In pytest-bdd v4.0, given steps are no longer fixtures. - Make gitweb_repo_metadata a fixture. - Remove errorneous fixture usage from the gitweb_repo_should_not_exist step (fixture gitweb_repo returned always None). Tested that gitweb functional tests pass when using pytest v4.0.2 Signed-off-by: Veiko Aasa Reviewed-by: James Valleroy --- plinth/modules/gitweb/tests/test_functional.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plinth/modules/gitweb/tests/test_functional.py b/plinth/modules/gitweb/tests/test_functional.py index 090ed08b7..9d25ed002 100644 --- a/plinth/modules/gitweb/tests/test_functional.py +++ b/plinth/modules/gitweb/tests/test_functional.py @@ -54,7 +54,8 @@ def gitweb_all_repositories_private(session_browser): _set_all_repos_private(session_browser) -@given(parsers.parse('a repository metadata:\n{metadata}')) +@given(parsers.parse('a repository metadata:\n{metadata}'), + target_fixture='gitweb_repo_metadata') def gitweb_repo_metadata(session_browser, metadata): metadata_dict = {} for item in metadata.split('\n'): @@ -108,8 +109,8 @@ def gitweb_private_repo_should_exists(session_browser): @then('the repository should not be listed') -def gitweb_repo_should_not_exist(session_browser, gitweb_repo): - assert not _repo_exists(session_browser, gitweb_repo) +def gitweb_repo_should_not_exist(session_browser): + assert not _repo_exists(session_browser, 'Test-repo') @then('the public repository should be listed on gitweb')