Accessing test file name from conftest.py

前端 未结 1 1537
Happy的楠姐
Happy的楠姐 2021-01-25 02:45

What I\'m trying to do

I\'m writing a small framework in python using pytest, and as part of the teardown I am taking a screenshot. Now, I want that scr

相关标签:
1条回答
  • 2021-01-25 03:29

    You can access the current file path via request.node.fspath. Example:

    # conftest.py
    import pytest
    
    @pytest.fixture
    def currpath(request):
        return str(request.node.fspath)
    
    0 讨论(0)
提交回复
热议问题