diff --git a/ruff.toml b/ruff.toml index a463695c4..a001befad 100644 --- a/ruff.toml +++ b/ruff.toml @@ -26,7 +26,6 @@ exclude = [ "node_modules", "site-packages", "venv", - "tests/*", ] # Same as Black. @@ -47,6 +46,9 @@ unfixable = [] # Allow unused variables when underscore-prefixed. dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" +[lint.extend-per-file-ignores] +"tests/*" = ["F401", "F811"] + [format] # Like Black, use double quotes for strings. quote-style = "double" diff --git a/tests/test_entity_hub.py b/tests/test_entity_hub.py index b593777e9..896349d7f 100644 --- a/tests/test_entity_hub.py +++ b/tests/test_entity_hub.py @@ -486,7 +486,7 @@ def test_create_delete_with_duplicated_names( subfolder_name, num_of_subfolders ): - """Creates two folders with duplicated names + """Creates two folders with duplicated names and delete one of them before commit. Exception should not be raised. """ @@ -499,7 +499,7 @@ def test_create_delete_with_duplicated_names( for folder_number in range(num_of_subfolders): subfolder = e.add_new_folder( "Folder", - parent_id=folder1["id"], + parent_id=folder1["id"], name=f"{subfolder_name}{folder_number:03}" ) subfolders.append(subfolder) @@ -508,7 +508,7 @@ def test_create_delete_with_duplicated_names( # create and delete folder with same name subfolder = e.add_new_folder( "Folder", - parent_id=folder1["id"], + parent_id=folder1["id"], name=f"{subfolder_name}{folder_number:03}" ) e.delete_entity(subfolder) @@ -565,7 +565,8 @@ def test_create_delete_with_duplicated_names( # # # raises an exception (duplicated names) # """ -# # switch the parent folders - duplicated names exception shouldn't be raised +# # switch the parent folders +# # - duplicated names exception shouldn't be raised # e.set_entity_parent(subfolders[0]["id"], folders[1]["id"]) # e.set_entity_parent(subfolders[1]["id"], folders[0]["id"]) # @@ -598,7 +599,10 @@ def test_create_delete_with_duplicated_names( # # # @pytest.mark.parametrize( -# "parent_folder_name, folder_name, subfolder_name, num_of_folders, num_of_subfolders", +# ( +# "parent_folder_name, folder_name, subfolder_name," +# " num_of_folders, num_of_subfolders" +# ), # [ # ("entity_hub_test", "folder", "subfolder", 2, 3), # ] @@ -648,7 +652,9 @@ def test_create_delete_with_duplicated_names( # # move all subfolders from one folder to the next one # for index, subfolder_id in enumerate(subfolder_ids): # # next folder (for last folder -> first folder) -# new_parent_id = folder_ids[(index // num_of_subfolders + 1) % num_of_folders] +# new_parent_id = folder_ids[ +# (index // num_of_subfolders + 1) % num_of_folders +# ] # # # test for me, if new_parent_id is generated correctly # subfolder = e.get_folder_by_id(subfolder_id) @@ -673,9 +679,16 @@ def test_create_delete_with_duplicated_names( # assert get_folders( # PROJECT_NAME, # folder_ids=subfolder_id, -# parent_ids=folder_ids[(index // num_of_subfolders + 1) % num_of_folders]) is not None -# # assert subfolder_id not in my_get_folder_ids(folder_ids[i // num_of_subfolders]) -# # assert subfolder_id in my_get_folder_ids(folder_ids[(i // num_of_subfolders + 1) % num_of_folders]) +# parent_ids=folder_ids[ +# (index // num_of_subfolders + 1) % num_of_folders +# ] +# ) is not None +# # assert subfolder_id not in my_get_folder_ids( +# # folder_ids[i // num_of_subfolders] +# # ) +# # assert subfolder_id in my_get_folder_ids( +# # folder_ids[(i // num_of_subfolders + 1) % num_of_folders] +# # ) # """ # # # e.delete_entity(parent_folder) diff --git a/tests/test_folder_hierarchy.py b/tests/test_folder_hierarchy.py index f69b6d67c..7d8200778 100644 --- a/tests/test_folder_hierarchy.py +++ b/tests/test_folder_hierarchy.py @@ -5,7 +5,6 @@ Make sure you have set AYON_TOKEN in your environment. """ -import os import pytest from ayon_api.operations import ( @@ -190,7 +189,10 @@ def test_product_duplicated_names( @pytest.mark.parametrize( - "folder_name, product_name, version_name, representation_name, num_of_versions, num_of_representations", + ( + "folder_name, product_name, version_name, representation_name," + " num_of_versions, num_of_representations" + ), [ ("whole_hierarchy", "modelMain", "version", "representation", 2, 3) ] @@ -387,7 +389,10 @@ def test_delete_folder_with_product( @pytest.mark.parametrize( - "folder_name, subfolder_name1, subfolder_name2, count_level1, count_level2", + ( + "folder_name, subfolder_name1, subfolder_name2," + " count_level1, count_level2" + ), [ ("folder_with_subfolders1", "subfolder", "shot", 2, 3), ("folder_with_subfolders2", "subfolder", "shot", 3, 4), @@ -402,8 +407,9 @@ def test_subfolder_hierarchy( count_level2 ): """Creates three levels of folder hierarchy and product in the last one. - Tries creating products with duplicated names and checks raising exceptions. - After creation of every product is checked if the product was really created. + Tries creating products with duplicated names and checks raising + exceptions. After creation of every product is checked if the product + was really created. """ project_name = project_entity_fixture["name"] s = OperationsSession() diff --git a/tests/test_graphql_queries.py b/tests/test_graphql_queries.py index 4e2ea90bd..731ec5e8c 100644 --- a/tests/test_graphql_queries.py +++ b/tests/test_graphql_queries.py @@ -30,7 +30,7 @@ def test_simple_duplicate_add_variable_exception( def test_exception_empty_query(empty_query): with pytest.raises(ValueError, match="Missing fields to query"): - out = empty_query.calculate_query() + _out = empty_query.calculate_query() def test_simple_project_query(): diff --git a/tests/test_server.py b/tests/test_server.py index cfc26b4d9..ce5a98d07 100644 --- a/tests/test_server.py +++ b/tests/test_server.py @@ -1,7 +1,7 @@ """Tests of server API. To run use: pytest --envfile {environment path}. -Make sure you have set AYON_TOKEN in your environment. +Make sure you have set AYON_TOKEN in your environment. """ import os @@ -21,7 +21,7 @@ def test_close_connection(): - con = get_server_api_connection() + _con = get_server_api_connection() assert is_connection_created() is True close_connection() assert is_connection_created() is False