PytestSetting Project Test System: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 16: Line 16:
<syntaxhighlight lang='py'>
<syntaxhighlight lang='py'>
import pytest
import pytest
 
from pathlib import Path
from my_module_to_test import some_function
from my_module_to_test import some_function



Revision as of 01:10, 9 June 2022

Internal

Layout

...
 └─ test
     └─ python
         └─ my_module
             ├─ data
             └─ test_my_function.py

Structure of a Test File

import pytest
from pathlib import Path
from my_module_to_test import some_function

def get_data_file(file_name):
    return Path(Path(__file__).parent, f'./data/{file_name}')