-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
let's move all this big string to files with resources.
you could have a CSV which can be load as fixture in the conftests. Or a JSON. Or anything that will be simple enough to maintain and that helps you to remove clutter out of the code.
Originally posted by @Edilmo in #68 (comment)
Proposed Solution
- Create a json file containing large texts that will be used to test different scrapers, ie
test_scraper_constants.json{ "el-pitazo": { "get-body-parse-ok": "super long text" } } - Create a
conftest.pywith the following contentsimport pytest @pytest.fixture def get_body_for_parse_ok(): filename = "../../resources/tests/scraper/test_scraper_constants.json" # should be relative to repo's root text_of_interest = _get_json_from_file['el-pitazo']['get-body-parse-ok'] return text_of_interest
- Use the fixture on the test file, ie:
test_some_name.pydef test_parse_ok(get_body_for_parse_ok):
conftest.py can be placed inside the folder where all tests needing to access such long text live.
Metadata
Metadata
Assignees
Labels
No labels