You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
870 B

  1. import os
  2. import json
  3. import pytest
  4. import _pytest
  5. TEST_PROPERTY_DATA_ROOT = "test_data/property_files"
  6. @pytest.fixture
  7. def canned_data_input(pytestconfig: _pytest.config.Config):
  8. # def canned_data_input():
  9. def get_canned_data(filename):
  10. full_path = os.path.join(
  11. pytestconfig.rootdir, TEST_PROPERTY_DATA_ROOT, filename
  12. )
  13. with open(full_path + ".txt", "r") as test_file:
  14. return test_file.read()
  15. return get_canned_data
  16. @pytest.fixture
  17. def canned_data_output(pytestconfig: _pytest.config.Config):
  18. # def canned_data_output():
  19. def get_canned_data(filename):
  20. full_path = os.path.join(
  21. pytestconfig.rootdir, TEST_PROPERTY_DATA_ROOT, filename
  22. )
  23. with open(full_path + ".json", "r") as test_file:
  24. return json.load(test_file)
  25. return get_canned_data