TestProfileRequirements.py 1.5 KB

123456789101112131415161718192021222324252627282930
  1. # Copyright (c) 2018 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. import configparser #To read the profiles.
  4. import os #To join paths.
  5. import pytest
  6. ## Makes sure that the variants for the Ultimaker 3 Extended are exactly the
  7. # same as for the Ultimaker 3.
  8. #
  9. # Once we have specialised profiles or a mechanism to inherit variants too, we
  10. # may remove this test and have different profiles for the extended where
  11. # needed, but until then we should keep them the same. It's happened all too
  12. # often that we updated the variants for the UM3 but forgot about the UM3E.
  13. @pytest.mark.parametrize("um3_file, um3e_file", [
  14. #List the corresponding files below.
  15. ("ultimaker3_aa0.25.inst.cfg", "ultimaker3_extended_aa0.25.inst.cfg"),
  16. ("ultimaker3_aa0.8.inst.cfg", "ultimaker3_extended_aa0.8.inst.cfg"),
  17. ("ultimaker3_aa04.inst.cfg", "ultimaker3_extended_aa04.inst.cfg"),
  18. ("ultimaker3_bb0.8.inst.cfg", "ultimaker3_extended_bb0.8.inst.cfg"),
  19. ("ultimaker3_bb04.inst.cfg", "ultimaker3_extended_bb04.inst.cfg")
  20. ])
  21. def test_ultimaker3extended_variants(um3_file, um3e_file):
  22. directory = os.path.join(os.path.dirname(__file__), "..", "resources", "variants") #TODO: Hardcoded path relative to this test file.
  23. um3 = configparser.ConfigParser()
  24. um3.read_file(open(os.path.join(directory, um3_file), encoding = "utf-8"))
  25. um3e = configparser.ConfigParser()
  26. um3e.read_file(open(os.path.join(directory, um3e_file), encoding = "utf-8"))
  27. assert [value for value in um3["values"]] == [value for value in um3e["values"]]