generate log files with the name of the test scripts

satya28 at gmail.com satya28 at gmail.com
Thu May 25 10:05:21 EDT 2017


Hi 
 I am working on an automation framework in Python and my tests are using pytest framework.
 Following is my folder structure.

 +test_fwk
      +helper_methods
      +resources
      +bins
      +src
          +targets
          +extensions
       custom.logger.py
       +xyz
  +tests
       +functional_tests
           test_a.py
        +stability_tests
           test_b.py
        +negative_tests
           test_c.py


Now I am running all my tests with the following command
    > pytest -v -s tests
which runs all my 3 tests above.

My requirement is for all these 3 tests 3 different log files should be created in a user given log folder with the respective script names, like below

under "tests" folder above "logs" folder should be created and in this folder I should get following log files.
   
      +logs
          test_a.log
          test_b.log
          test_c.log

And in these log files, logs from different other python modules (if uses) should be captured.



Could you please help me with this?



More information about the Python-list mailing list