Usiel commented on code in PR #32709:
URL: https://github.com/apache/airflow/pull/32709#discussion_r1281588863
##########
tests/cli/commands/test_pool_command.py:
##########
@@ -88,19 +100,34 @@ def test_pool_import_invalid_json(self):
pool_command.pool_import(self.parser.parse_args(["pools",
"import", "pools_import_invalid.json"]))
def test_pool_import_invalid_pools(self):
- pool_config_input = {"foo": {"description": "foo_test"}}
+ pool_config_input = {"foo": {"description": "foo_test",
"include_deferred": False}}
with open("pools_import_invalid.json", mode="w") as file:
json.dump(pool_config_input, file)
with pytest.raises(SystemExit):
pool_command.pool_import(self.parser.parse_args(["pools",
"import", "pools_import_invalid.json"]))
+ def test_pool_import_backwards_compatibility(self):
+ try:
+ pool_config_input = {
+ # JSON before version 2.7.0 does not contain `include_deferred`
+ "foo": {"description": "foo_test", "slots": 1},
+ }
+ with open("pools_import.json", mode="w") as file:
+ json.dump(pool_config_input, file)
+
+ pool_command.pool_import(self.parser.parse_args(["pools",
"import", "pools_import.json"]))
+
+ assert self.session.query(Pool).filter(Pool.pool ==
"foo").first().include_deferred is False
+ finally:
+ os.remove("pools_import.json")
Review Comment:
Oh nice! Fixed up the remaining tests as well.
`tmp_path` seems to be the new thing replacing tmpdir
([ref](https://docs.pytest.org/en/7.1.x/how-to/tmp_path.html#the-tmpdir-and-tmpdir-factory-fixtures)).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]