test_job_config.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Copyright 2021-2024 Avaiga Private Limited
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  4. # the License. You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  9. # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  10. # specific language governing permissions and limitations under the License.
  11. from taipy.common.config import Config
  12. def test_job_config():
  13. assert Config.job_config.mode == "development"
  14. job_c = Config.configure_job_executions(mode="standalone", max_nb_of_workers=3)
  15. assert job_c.mode == "standalone"
  16. assert job_c.max_nb_of_workers == 3
  17. assert Config.job_config.mode == "standalone"
  18. assert Config.job_config.max_nb_of_workers == 3
  19. Config.configure_job_executions(foo="bar")
  20. assert Config.job_config.foo == "bar"
  21. def test_clean_config():
  22. job_config = Config.configure_job_executions(mode="standalone", max_nb_of_workers=3, prop="foo")
  23. assert Config.job_config is job_config
  24. job_config._clean()
  25. # Check if the instance before and after _clean() is the same
  26. assert Config.job_config is job_config
  27. assert job_config.mode == "development"
  28. assert job_config.properties == {}