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:
643
643
)
644
644
645
645
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
+
646
652
@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 :
648
657
"""Return URL to the fixture source."""
649
658
if hasattr (request .node , "github_url" ):
650
659
return request .node .github_url
651
660
function_line_number = request .function .__code__ .co_firstlineno
652
661
module_relative_path = os .path .relpath (request .module .__file__ )
653
- hash_or_tag = get_current_commit_hash_or_tag ()
654
662
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 ,
656
666
)
657
667
return github_url
658
668
You can’t perform that action at this time.
0 commit comments