| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
import os |
| 6 |
import pathlib |
| 7 |
import pytest |
| 8 |
from scalene.launchbrowser import read_file_content |
| 9 |
|
| 10 |
|
| 11 |
@pytest.fixture |
| 12 |
def temp_test_directory(tmp_path): |
| 13 |
|
| 14 |
directory = tmp_path / "test_dir" |
| 15 |
subdirectory = directory / "sub_dir" |
| 16 |
subdirectory.mkdir(parents=True) |
| 17 |
|
| 18 |
test_file = subdirectory / "test_file.txt" |
| 19 |
test_file.write_text("Test content") |
| 20 |
return str(directory), "sub_dir", "test_file.txt" |
| 21 |
|
| 22 |
|
| 23 |
def test_read_file_content(temp_test_directory): |
| 24 |
directory, subdirectory, filename = temp_test_directory |
| 25 |
|
| 26 |
content = read_file_content(directory, subdirectory, filename) |
| 27 |
|
| 28 |
assert content == "Test content" |