File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
src/pytest_plugins/filler Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -643,16 +643,26 @@ def node_to_test_info(node: pytest.Item) -> TestInfo:
643643 )
644644
645645
646+ @pytest .fixture (scope = "session" )
647+ def commit_hash_or_tag () -> str :
648+ """Cache the git commit hash or tag for the entire test session."""
649+ return get_current_commit_hash_or_tag ()
650+
651+
646652@pytest .fixture (scope = "function" )
647- def fixture_source_url (request : pytest .FixtureRequest ) -> str :
653+ def fixture_source_url (
654+ request : pytest .FixtureRequest ,
655+ commit_hash_or_tag : str ,
656+ ) -> str :
648657 """Return URL to the fixture source."""
649658 if hasattr (request .node , "github_url" ):
650659 return request .node .github_url
651660 function_line_number = request .function .__code__ .co_firstlineno
652661 module_relative_path = os .path .relpath (request .module .__file__ )
653- hash_or_tag = get_current_commit_hash_or_tag ()
654662 github_url = generate_github_url (
655- module_relative_path , branch_or_commit_or_tag = hash_or_tag , line_number = function_line_number
663+ module_relative_path ,
664+ branch_or_commit_or_tag = commit_hash_or_tag ,
665+ line_number = function_line_number ,
656666 )
657667 return github_url
658668
You can’t perform that action at this time.
0 commit comments