You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.py with the following contents
importpytest@pytest.fixturedefget_body_for_parse_ok():
filename="../../resources/tests/scraper/test_scraper_constants.json"# should be relative to repo's roottext_of_interest=_get_json_from_file['el-pitazo']['get-body-parse-ok']
returntext_of_interest
Use the fixture on the test file, ie: test_some_name.py
deftest_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.
The text was updated successfully, but these errors were encountered:
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
test_scraper_constants.json
conftest.py
with the following contentstest_some_name.py
conftest.py
can be placed inside the folder where all tests needing to access such long text live.The text was updated successfully, but these errors were encountered: