This is an automated email from the ASF dual-hosted git repository.
fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/master by this push:
new 03a8b061f1 Python: Update `test_console` tests (#7683)
03a8b061f1 is described below
commit 03a8b061f19d978ef4d4d974b36d76e68c9f2f99
Author: Luigi Cerone <[email protected]>
AuthorDate: Tue Jul 4 21:16:45 2023 +0200
Python: Update `test_console` tests (#7683)
* Update test_console tests
* Update poetry.lock file
---
python/poetry.lock | 147 +++---
python/pyproject.toml | 11 +-
python/tests/catalog/test_base.py | 6 +-
python/tests/cli/test_console.py | 1018 +++++++++++++++++++------------------
4 files changed, 606 insertions(+), 576 deletions(-)
diff --git a/python/poetry.lock b/python/poetry.lock
index 322a2eb018..03fabb8da2 100644
--- a/python/poetry.lock
+++ b/python/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 1.5.1 and should not be
changed by hand.
+# This file is automatically @generated by Poetry 1.5.0 and should not be
changed by hand.
[[package]]
name = "adlfs"
@@ -24,24 +24,24 @@ docs = ["furo", "myst-parser", "numpydoc", "sphinx"]
[[package]]
name = "aiobotocore"
-version = "2.5.0"
+version = "2.5.1"
description = "Async client for aws services using botocore and aiohttp"
optional = true
python-versions = ">=3.7"
files = [
- {file = "aiobotocore-2.5.0-py3-none-any.whl", hash =
"sha256:9a2a022d7b78ec9a2af0de589916d2721cddbf96264401b78d7a73c1a1435f3b"},
- {file = "aiobotocore-2.5.0.tar.gz", hash =
"sha256:6a5b397cddd4f81026aa91a14c7dd2650727425740a5af8ba75127ff663faf67"},
+ {file = "aiobotocore-2.5.1-py3-none-any.whl", hash =
"sha256:3dce68cfdb351f3a6922ad2f3b6274146b7d43a59d6ed24e5185788e67b35f02"},
+ {file = "aiobotocore-2.5.1.tar.gz", hash =
"sha256:1106ed649a1f8980dcae503c69ff5dc9aa51f72d4e270724954c9add6dd4f234"},
]
[package.dependencies]
-aiohttp = ">=3.3.1"
-aioitertools = ">=0.5.1"
-botocore = ">=1.29.76,<1.29.77"
-wrapt = ">=1.10.10"
+aiohttp = ">=3.3.1,<4.0.0"
+aioitertools = ">=0.5.1,<1.0.0"
+botocore = ">=1.29.161,<1.29.162"
+wrapt = ">=1.10.10,<2.0.0"
[package.extras]
-awscli = ["awscli (>=1.27.76,<1.27.77)"]
-boto3 = ["boto3 (>=1.26.76,<1.26.77)"]
+awscli = ["awscli (>=1.27.161,<1.27.162)"]
+boto3 = ["boto3 (>=1.26.161,<1.26.162)"]
[[package]]
name = "aiohttp"
@@ -283,17 +283,17 @@ aio = ["azure-core[aio] (>=1.26.0,<2.0.0)"]
[[package]]
name = "boto3"
-version = "1.26.76"
+version = "1.26.161"
description = "The AWS SDK for Python"
optional = false
python-versions = ">= 3.7"
files = [
- {file = "boto3-1.26.76-py3-none-any.whl", hash =
"sha256:b4c2969b7677762914394b8273cc1905dfe5b71f250741c1a575487ae357e729"},
- {file = "boto3-1.26.76.tar.gz", hash =
"sha256:30c7d967ed1c6b5a05643e42cae9d4d36c3f1cb6782637ddc7007a104cfd9027"},
+ {file = "boto3-1.26.161-py3-none-any.whl", hash =
"sha256:f66e5c9dbe7f34383bcf64fa6070771355c11a44dd75c7f1279f2f37e1c89183"},
+ {file = "boto3-1.26.161.tar.gz", hash =
"sha256:662731e464d14af1035f44fc6a46b0e3112ee011ac0a5ed416d205daa3e15f25"},
]
[package.dependencies]
-botocore = ">=1.29.76,<1.30.0"
+botocore = ">=1.29.161,<1.30.0"
jmespath = ">=0.7.1,<2.0.0"
s3transfer = ">=0.6.0,<0.7.0"
@@ -302,13 +302,13 @@ crt = ["botocore[crt] (>=1.21.0,<2.0a0)"]
[[package]]
name = "botocore"
-version = "1.29.76"
+version = "1.29.161"
description = "Low-level, data-driven core of boto 3."
optional = false
python-versions = ">= 3.7"
files = [
- {file = "botocore-1.29.76-py3-none-any.whl", hash =
"sha256:70735b00cd529f152992231ca6757e458e5ec25db43767b3526e9a35b2f143b7"},
- {file = "botocore-1.29.76.tar.gz", hash =
"sha256:c2f67b6b3f8acf2968eafca06526f07b9fb0d27bac4c68a635d51abb675134a7"},
+ {file = "botocore-1.29.161-py3-none-any.whl", hash =
"sha256:b906999dd53dda2ef0ef6f7f55fcc81a4b06b9f1c8a9f65c546e0b981f959f5f"},
+ {file = "botocore-1.29.161.tar.gz", hash =
"sha256:a50edd715eb510343e27849f36483804aae4b871590db4d4996aa53368dcac40"},
]
[package.dependencies]
@@ -750,13 +750,13 @@ files = [
[[package]]
name = "exceptiongroup"
-version = "1.1.1"
+version = "1.1.2"
description = "Backport of PEP 654 (exception groups)"
optional = false
python-versions = ">=3.7"
files = [
- {file = "exceptiongroup-1.1.1-py3-none-any.whl", hash =
"sha256:232c37c63e4f682982c8b6459f33a8981039e5fb8756b2074364e5055c498c9e"},
- {file = "exceptiongroup-1.1.1.tar.gz", hash =
"sha256:d484c3090ba2889ae2928419117447a14daf3c1231d5e30d0aae34f354f01785"},
+ {file = "exceptiongroup-1.1.2-py3-none-any.whl", hash =
"sha256:e346e69d186172ca7cf029c8c1d16235aa0e04035e5750b4b95039e65204328f"},
+ {file = "exceptiongroup-1.1.2.tar.gz", hash =
"sha256:12c3e887d6485d16943a309616de20ae5582633e0a2eda17f4e10fd61c1e8af5"},
]
[package.extras]
@@ -1848,47 +1848,47 @@ files = [
[[package]]
name = "pydantic"
-version = "1.10.10"
+version = "1.10.11"
description = "Data validation and settings management using python type hints"
optional = false
python-versions = ">=3.7"
files = [
- {file = "pydantic-1.10.10-cp310-cp310-macosx_10_9_x86_64.whl", hash =
"sha256:adad1ee4ab9888f12dac2529276704e719efcf472e38df7813f5284db699b4ec"},
- {file = "pydantic-1.10.10-cp310-cp310-macosx_11_0_arm64.whl", hash =
"sha256:7a7db03339893feef2092ff7b1afc9497beed15ebd4af84c3042a74abce02d48"},
- {file =
"pydantic-1.10.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
hash =
"sha256:67b3714b97ff84b2689654851c2426389bcabfac9080617bcf4306c69db606f6"},
- {file =
"pydantic-1.10.10-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
hash =
"sha256:edfdf0a5abc5c9bf2052ebaec20e67abd52e92d257e4f2d30e02c354ed3e6030"},
- {file = "pydantic-1.10.10-cp310-cp310-musllinux_1_1_i686.whl", hash =
"sha256:20a3b30fd255eeeb63caa9483502ba96b7795ce5bf895c6a179b3d909d9f53a6"},
- {file = "pydantic-1.10.10-cp310-cp310-musllinux_1_1_x86_64.whl", hash =
"sha256:db4c7f7e60ca6f7d6c1785070f3e5771fcb9b2d88546e334d2f2c3934d949028"},
- {file = "pydantic-1.10.10-cp310-cp310-win_amd64.whl", hash =
"sha256:a2d5be50ac4a0976817144c7d653e34df2f9436d15555189f5b6f61161d64183"},
- {file = "pydantic-1.10.10-cp311-cp311-macosx_10_9_x86_64.whl", hash =
"sha256:566a04ba755e8f701b074ffb134ddb4d429f75d5dced3fbd829a527aafe74c71"},
- {file = "pydantic-1.10.10-cp311-cp311-macosx_11_0_arm64.whl", hash =
"sha256:f79db3652ed743309f116ba863dae0c974a41b688242482638b892246b7db21d"},
- {file =
"pydantic-1.10.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
hash =
"sha256:c62376890b819bebe3c717a9ac841a532988372b7e600e76f75c9f7c128219d5"},
- {file =
"pydantic-1.10.10-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
hash =
"sha256:4870f13a4fafd5bc3e93cff3169222534fad867918b188e83ee0496452978437"},
- {file = "pydantic-1.10.10-cp311-cp311-musllinux_1_1_i686.whl", hash =
"sha256:990027e77cda6072a566e433b6962ca3b96b4f3ae8bd54748e9d62a58284d9d7"},
- {file = "pydantic-1.10.10-cp311-cp311-musllinux_1_1_x86_64.whl", hash =
"sha256:8c40964596809eb616d94f9c7944511f620a1103d63d5510440ed2908fc410af"},
- {file = "pydantic-1.10.10-cp311-cp311-win_amd64.whl", hash =
"sha256:ea9eebc2ebcba3717e77cdeee3f6203ffc0e78db5f7482c68b1293e8cc156e5e"},
- {file = "pydantic-1.10.10-cp37-cp37m-macosx_10_9_x86_64.whl", hash =
"sha256:762aa598f79b4cac2f275d13336b2dd8662febee2a9c450a49a2ab3bec4b385f"},
- {file =
"pydantic-1.10.10-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
hash =
"sha256:6dab5219659f95e357d98d70577b361383057fb4414cfdb587014a5f5c595f7b"},
- {file =
"pydantic-1.10.10-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
hash =
"sha256:f3d4ee957a727ccb5a36f1b0a6dbd9fad5dedd2a41eada99a8df55c12896e18d"},
- {file = "pydantic-1.10.10-cp37-cp37m-musllinux_1_1_i686.whl", hash =
"sha256:b69f9138dec566962ec65623c9d57bee44412d2fc71065a5f3ebb3820bdeee96"},
- {file = "pydantic-1.10.10-cp37-cp37m-musllinux_1_1_x86_64.whl", hash =
"sha256:7aa75d1bd9cc275cf9782f50f60cddaf74cbaae19b6ada2a28e737edac420312"},
- {file = "pydantic-1.10.10-cp37-cp37m-win_amd64.whl", hash =
"sha256:9f62a727f5c590c78c2d12fda302d1895141b767c6488fe623098f8792255fe5"},
- {file = "pydantic-1.10.10-cp38-cp38-macosx_10_9_x86_64.whl", hash =
"sha256:aac218feb4af73db8417ca7518fb3bade4534fcca6e3fb00f84966811dd94450"},
- {file = "pydantic-1.10.10-cp38-cp38-macosx_11_0_arm64.whl", hash =
"sha256:88546dc10a40b5b52cae87d64666787aeb2878f9a9b37825aedc2f362e7ae1da"},
- {file =
"pydantic-1.10.10-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
hash =
"sha256:c41bbaae89e32fc582448e71974de738c055aef5ab474fb25692981a08df808a"},
- {file =
"pydantic-1.10.10-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
hash =
"sha256:2b71bd504d1573b0b722ae536e8ffb796bedeef978979d076bf206e77dcc55a5"},
- {file = "pydantic-1.10.10-cp38-cp38-musllinux_1_1_i686.whl", hash =
"sha256:e088e3865a2270ecbc369924cd7d9fbc565667d9158e7f304e4097ebb9cf98dd"},
- {file = "pydantic-1.10.10-cp38-cp38-musllinux_1_1_x86_64.whl", hash =
"sha256:3403a090db45d4027d2344859d86eb797484dfda0706cf87af79ace6a35274ef"},
- {file = "pydantic-1.10.10-cp38-cp38-win_amd64.whl", hash =
"sha256:e0014e29637125f4997c174dd6167407162d7af0da73414a9340461ea8573252"},
- {file = "pydantic-1.10.10-cp39-cp39-macosx_10_9_x86_64.whl", hash =
"sha256:9965e49c6905840e526e5429b09e4c154355b6ecc0a2f05492eda2928190311d"},
- {file = "pydantic-1.10.10-cp39-cp39-macosx_11_0_arm64.whl", hash =
"sha256:748d10ab6089c5d196e1c8be9de48274f71457b01e59736f7a09c9dc34f51887"},
- {file =
"pydantic-1.10.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
hash =
"sha256:86936c383f7c38fd26d35107eb669c85d8f46dfceae873264d9bab46fe1c7dde"},
- {file =
"pydantic-1.10.10-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
hash =
"sha256:7a26841be620309a9697f5b1ffc47dce74909e350c5315ccdac7a853484d468a"},
- {file = "pydantic-1.10.10-cp39-cp39-musllinux_1_1_i686.whl", hash =
"sha256:409b810f387610cc7405ab2fa6f62bdf7ea485311845a242ebc0bd0496e7e5ac"},
- {file = "pydantic-1.10.10-cp39-cp39-musllinux_1_1_x86_64.whl", hash =
"sha256:ce937a2a2c020bcad1c9fde02892392a1123de6dda906ddba62bfe8f3e5989a2"},
- {file = "pydantic-1.10.10-cp39-cp39-win_amd64.whl", hash =
"sha256:37ebddef68370e6f26243acc94de56d291e01227a67b2ace26ea3543cf53dd5f"},
- {file = "pydantic-1.10.10-py3-none-any.whl", hash =
"sha256:a5939ec826f7faec434e2d406ff5e4eaf1716eb1f247d68cd3d0b3612f7b4c8a"},
- {file = "pydantic-1.10.10.tar.gz", hash =
"sha256:3b8d5bd97886f9eb59260594207c9f57dce14a6f869c6ceea90188715d29921a"},
+ {file = "pydantic-1.10.11-cp310-cp310-macosx_10_9_x86_64.whl", hash =
"sha256:ff44c5e89315b15ff1f7fdaf9853770b810936d6b01a7bcecaa227d2f8fe444f"},
+ {file = "pydantic-1.10.11-cp310-cp310-macosx_11_0_arm64.whl", hash =
"sha256:a6c098d4ab5e2d5b3984d3cb2527e2d6099d3de85630c8934efcfdc348a9760e"},
+ {file =
"pydantic-1.10.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
hash =
"sha256:16928fdc9cb273c6af00d9d5045434c39afba5f42325fb990add2c241402d151"},
+ {file =
"pydantic-1.10.11-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
hash =
"sha256:0588788a9a85f3e5e9ebca14211a496409cb3deca5b6971ff37c556d581854e7"},
+ {file = "pydantic-1.10.11-cp310-cp310-musllinux_1_1_i686.whl", hash =
"sha256:e9baf78b31da2dc3d3f346ef18e58ec5f12f5aaa17ac517e2ffd026a92a87588"},
+ {file = "pydantic-1.10.11-cp310-cp310-musllinux_1_1_x86_64.whl", hash =
"sha256:373c0840f5c2b5b1ccadd9286782852b901055998136287828731868027a724f"},
+ {file = "pydantic-1.10.11-cp310-cp310-win_amd64.whl", hash =
"sha256:c3339a46bbe6013ef7bdd2844679bfe500347ac5742cd4019a88312aa58a9847"},
+ {file = "pydantic-1.10.11-cp311-cp311-macosx_10_9_x86_64.whl", hash =
"sha256:08a6c32e1c3809fbc49debb96bf833164f3438b3696abf0fbeceb417d123e6eb"},
+ {file = "pydantic-1.10.11-cp311-cp311-macosx_11_0_arm64.whl", hash =
"sha256:a451ccab49971af043ec4e0d207cbc8cbe53dbf148ef9f19599024076fe9c25b"},
+ {file =
"pydantic-1.10.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
hash =
"sha256:5b02d24f7b2b365fed586ed73582c20f353a4c50e4be9ba2c57ab96f8091ddae"},
+ {file =
"pydantic-1.10.11-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
hash =
"sha256:3f34739a89260dfa420aa3cbd069fbcc794b25bbe5c0a214f8fb29e363484b66"},
+ {file = "pydantic-1.10.11-cp311-cp311-musllinux_1_1_i686.whl", hash =
"sha256:e297897eb4bebde985f72a46a7552a7556a3dd11e7f76acda0c1093e3dbcf216"},
+ {file = "pydantic-1.10.11-cp311-cp311-musllinux_1_1_x86_64.whl", hash =
"sha256:d185819a7a059550ecb85d5134e7d40f2565f3dd94cfd870132c5f91a89cf58c"},
+ {file = "pydantic-1.10.11-cp311-cp311-win_amd64.whl", hash =
"sha256:4400015f15c9b464c9db2d5d951b6a780102cfa5870f2c036d37c23b56f7fc1b"},
+ {file = "pydantic-1.10.11-cp37-cp37m-macosx_10_9_x86_64.whl", hash =
"sha256:2417de68290434461a266271fc57274a138510dca19982336639484c73a07af6"},
+ {file =
"pydantic-1.10.11-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
hash =
"sha256:331c031ba1554b974c98679bd0780d89670d6fd6f53f5d70b10bdc9addee1713"},
+ {file =
"pydantic-1.10.11-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
hash =
"sha256:8268a735a14c308923e8958363e3a3404f6834bb98c11f5ab43251a4e410170c"},
+ {file = "pydantic-1.10.11-cp37-cp37m-musllinux_1_1_i686.whl", hash =
"sha256:44e51ba599c3ef227e168424e220cd3e544288c57829520dc90ea9cb190c3248"},
+ {file = "pydantic-1.10.11-cp37-cp37m-musllinux_1_1_x86_64.whl", hash =
"sha256:d7781f1d13b19700b7949c5a639c764a077cbbdd4322ed505b449d3ca8edcb36"},
+ {file = "pydantic-1.10.11-cp37-cp37m-win_amd64.whl", hash =
"sha256:7522a7666157aa22b812ce14c827574ddccc94f361237ca6ea8bb0d5c38f1629"},
+ {file = "pydantic-1.10.11-cp38-cp38-macosx_10_9_x86_64.whl", hash =
"sha256:bc64eab9b19cd794a380179ac0e6752335e9555d214cfcb755820333c0784cb3"},
+ {file = "pydantic-1.10.11-cp38-cp38-macosx_11_0_arm64.whl", hash =
"sha256:8dc77064471780262b6a68fe67e013298d130414d5aaf9b562c33987dbd2cf4f"},
+ {file =
"pydantic-1.10.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
hash =
"sha256:fe429898f2c9dd209bd0632a606bddc06f8bce081bbd03d1c775a45886e2c1cb"},
+ {file =
"pydantic-1.10.11-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
hash =
"sha256:192c608ad002a748e4a0bed2ddbcd98f9b56df50a7c24d9a931a8c5dd053bd3d"},
+ {file = "pydantic-1.10.11-cp38-cp38-musllinux_1_1_i686.whl", hash =
"sha256:ef55392ec4bb5721f4ded1096241e4b7151ba6d50a50a80a2526c854f42e6a2f"},
+ {file = "pydantic-1.10.11-cp38-cp38-musllinux_1_1_x86_64.whl", hash =
"sha256:41e0bb6efe86281623abbeeb0be64eab740c865388ee934cd3e6a358784aca6e"},
+ {file = "pydantic-1.10.11-cp38-cp38-win_amd64.whl", hash =
"sha256:265a60da42f9f27e0b1014eab8acd3e53bd0bad5c5b4884e98a55f8f596b2c19"},
+ {file = "pydantic-1.10.11-cp39-cp39-macosx_10_9_x86_64.whl", hash =
"sha256:469adf96c8e2c2bbfa655fc7735a2a82f4c543d9fee97bd113a7fb509bf5e622"},
+ {file = "pydantic-1.10.11-cp39-cp39-macosx_11_0_arm64.whl", hash =
"sha256:e6cbfbd010b14c8a905a7b10f9fe090068d1744d46f9e0c021db28daeb8b6de1"},
+ {file =
"pydantic-1.10.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
hash =
"sha256:abade85268cc92dff86d6effcd917893130f0ff516f3d637f50dadc22ae93999"},
+ {file =
"pydantic-1.10.11-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl",
hash =
"sha256:e9738b0f2e6c70f44ee0de53f2089d6002b10c33264abee07bdb5c7f03038303"},
+ {file = "pydantic-1.10.11-cp39-cp39-musllinux_1_1_i686.whl", hash =
"sha256:787cf23e5a0cde753f2eabac1b2e73ae3844eb873fd1f5bdbff3048d8dbb7604"},
+ {file = "pydantic-1.10.11-cp39-cp39-musllinux_1_1_x86_64.whl", hash =
"sha256:174899023337b9fc685ac8adaa7b047050616136ccd30e9070627c1aaab53a13"},
+ {file = "pydantic-1.10.11-cp39-cp39-win_amd64.whl", hash =
"sha256:1954f8778489a04b245a1e7b8b22a9d3ea8ef49337285693cf6959e4b757535e"},
+ {file = "pydantic-1.10.11-py3-none-any.whl", hash =
"sha256:008c5e266c8aada206d0627a011504e14268a62091450210eda7c07fabe6963e"},
+ {file = "pydantic-1.10.11.tar.gz", hash =
"sha256:f66d479cf7eb331372c470614be6511eae96f1f120344c25f3f9bb59fb1b5528"},
]
[package.dependencies]
@@ -2038,6 +2038,23 @@ importlib-metadata = {version = ">=4", markers =
"python_version < \"3.10\""}
docs = ["furo", "jaraco.packaging (>=9)", "rst.linker (>=1.9)", "sphinx
(>=3.5)"]
testing = ["flake8 (<5)", "pytest (>=6)", "pytest-black (>=0.3.7)",
"pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)",
"pytest-flake8", "pytest-mypy (>=0.9.1)", "types-docutils"]
+[[package]]
+name = "pytest-mock"
+version = "3.10.0"
+description = "Thin-wrapper around the mock package for easier use with pytest"
+optional = false
+python-versions = ">=3.7"
+files = [
+ {file = "pytest-mock-3.10.0.tar.gz", hash =
"sha256:fbbdb085ef7c252a326fd8cdcac0aa3b1333d8811f131bdcc701002e1be7ed4f"},
+ {file = "pytest_mock-3.10.0-py3-none-any.whl", hash =
"sha256:f4c973eeae0282963eb293eb173ce91b091a79c1334455acfac9ddee8a1c784b"},
+]
+
+[package.dependencies]
+pytest = ">=5.0"
+
+[package.extras]
+dev = ["pre-commit", "pytest-asyncio", "tox"]
+
[[package]]
name = "python-dateutil"
version = "2.8.2"
@@ -2278,13 +2295,13 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
[[package]]
name = "requests-mock"
-version = "1.11.0"
+version = "1.10.0"
description = "Mock out responses from the requests package"
optional = false
python-versions = "*"
files = [
- {file = "requests-mock-1.11.0.tar.gz", hash =
"sha256:ef10b572b489a5f28e09b708697208c4a3b2b89ef80a9f01584340ea357ec3c4"},
- {file = "requests_mock-1.11.0-py2.py3-none-any.whl", hash =
"sha256:f7fae383f228633f6bececebdab236c478ace2284d6292c6e7e2867b9ab74d15"},
+ {file = "requests-mock-1.10.0.tar.gz", hash =
"sha256:59c9c32419a9fb1ae83ec242d98e889c45bd7d7a65d48375cc243ec08441658b"},
+ {file = "requests_mock-1.10.0-py2.py3-none-any.whl", hash =
"sha256:2fdbb637ad17ee15c06f33d31169e71bf9fe2bdb7bc9da26185be0dd8d842699"},
]
[package.dependencies]
@@ -2293,7 +2310,7 @@ six = "*"
[package.extras]
fixture = ["fixtures"]
-test = ["fixtures", "mock", "purl", "pytest", "requests-futures", "sphinx",
"testtools"]
+test = ["fixtures", "mock", "purl", "pytest", "requests-futures", "sphinx",
"testrepository (>=0.0.18)", "testtools"]
[[package]]
name = "responses"
@@ -2465,13 +2482,13 @@ files = [
[[package]]
name = "typing-extensions"
-version = "4.7.0"
+version = "4.5.0"
description = "Backported and Experimental Type Hints for Python 3.7+"
optional = false
python-versions = ">=3.7"
files = [
- {file = "typing_extensions-4.7.0-py3-none-any.whl", hash =
"sha256:5d8c9dac95c27d20df12fb1d97b9793ab8b2af8a3a525e68c80e21060c161771"},
- {file = "typing_extensions-4.7.0.tar.gz", hash =
"sha256:935ccf31549830cda708b42289d44b6f74084d616a00be651601a4f968e77c82"},
+ {file = "typing_extensions-4.5.0-py3-none-any.whl", hash =
"sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"},
+ {file = "typing_extensions-4.5.0.tar.gz", hash =
"sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"},
]
[[package]]
@@ -2809,4 +2826,4 @@ zstandard = ["zstandard"]
[metadata]
lock-version = "2.0"
python-versions = "^3.8"
-content-hash =
"ca207054617364d387dd3624a895805fb417b819011c0e823ca03bc42471a144"
+content-hash =
"2d82c34eff875704f396c002b5a32f0f240747d26a5aed018674356314f86ebd"
diff --git a/python/pyproject.toml b/python/pyproject.toml
index d5336bf1b7..68fe8a57c2 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -69,9 +69,14 @@ pytest-checkdocs = "2.9.0"
pre-commit = "3.3.3"
fastavro = "1.7.4"
coverage = { version = "^7.2.3", extras = ["toml"] }
-requests-mock = "1.11.0"
-moto = "^4.1.12"
-typing-extensions = "^4.7.0"
+requests-mock = "1.10.0"
+moto = "^4.1.7"
+typing-extensions = "4.5.0"
+pytest-mock = "3.10.0"
+
+[[tool.mypy.overrides]]
+module = "pytest_mock.*"
+ignore_missing_imports = true
[tool.poetry.scripts]
pyiceberg = "pyiceberg.cli.console:run"
diff --git a/python/tests/catalog/test_base.py
b/python/tests/catalog/test_base.py
index 29b63e0900..b47aa5f5f7 100644
--- a/python/tests/catalog/test_base.py
+++ b/python/tests/catalog/test_base.py
@@ -96,7 +96,7 @@ class InMemoryCatalog(Catalog):
],
},
"partition-spec": [{"name": "x", "transform":
"identity", "source-id": 1, "field-id": 1000}],
- "properties": {},
+ "properties": properties,
"current-snapshot-id": -1,
"snapshots": [{"snapshot-id": 1925, "timestamp-ms":
1602638573822}],
}
@@ -175,6 +175,10 @@ class InMemoryCatalog(Catalog):
return list_tables
def list_namespaces(self, namespace: Union[str, Identifier] = ()) ->
List[Identifier]:
+ # Hierarchical namespace is not supported. Return an empty list
+ if namespace:
+ return []
+
return list(self.__namespaces.keys())
def load_namespace_properties(self, namespace: Union[str, Identifier]) ->
Properties:
diff --git a/python/tests/cli/test_console.py b/python/tests/cli/test_console.py
index 4aaec26a78..31c062a228 100644
--- a/python/tests/cli/test_console.py
+++ b/python/tests/cli/test_console.py
@@ -15,293 +15,159 @@
# specific language governing permissions and limitations
# under the License.
import os
-from typing import (
- List,
- Optional,
- Set,
- Union,
-)
-from unittest import mock
+import pytest
from click.testing import CliRunner
+from pytest_mock import MockFixture
-from pyiceberg.catalog import Catalog, PropertiesUpdateSummary
-from pyiceberg.catalog.noop import NoopCatalog
from pyiceberg.cli.console import run
-from pyiceberg.exceptions import NoSuchNamespaceError, NoSuchTableError
-from pyiceberg.io import load_file_io
-from pyiceberg.partitioning import UNPARTITIONED_PARTITION_SPEC, PartitionSpec
+from pyiceberg.partitioning import PartitionField, PartitionSpec
from pyiceberg.schema import Schema
-from pyiceberg.table import CommitTableRequest, CommitTableResponse, Table
-from pyiceberg.table.metadata import TableMetadataV2
-from pyiceberg.table.sorting import UNSORTED_SORT_ORDER, SortOrder
-from pyiceberg.typedef import EMPTY_DICT, Identifier, Properties
+from pyiceberg.transforms import IdentityTransform
+from pyiceberg.typedef import Properties
from pyiceberg.utils.config import Config
-
-EXAMPLE_TABLE_METADATA_V2 = {
- "format-version": 2,
- "table-uuid": "9c12d441-03fe-4693-9a96-a0705ddf69c1",
- "location": "s3://bucket/test/location",
- "last-sequence-number": 34,
- "last-updated-ms": 1602638573590,
- "last-column-id": 3,
- "current-schema-id": 1,
- "schemas": [
- {"type": "struct", "schema-id": 0, "fields": [{"id": 1, "name": "x",
"required": True, "type": "long"}]},
- {
- "type": "struct",
- "schema-id": 1,
- "identifier-field-ids": [1, 2],
- "fields": [
- {"id": 1, "name": "x", "required": True, "type": "long"},
- {"id": 2, "name": "y", "required": True, "type": "long",
"doc": "comment"},
- {"id": 3, "name": "z", "required": True, "type": "long"},
- ],
- },
- ],
- "default-spec-id": 0,
- "partition-specs": [{"spec-id": 0, "fields": [{"name": "x", "transform":
"identity", "source-id": 1, "field-id": 1000}]}],
- "last-partition-id": 1000,
- "default-sort-order-id": 3,
- "sort-orders": [
- {
- "order-id": 3,
- "fields": [
- {"transform": "identity", "source-id": 2, "direction": "asc",
"null-order": "nulls-first"},
- {"transform": "bucket[4]", "source-id": 3, "direction":
"desc", "null-order": "nulls-last"},
- ],
- }
- ],
- "properties": {"read.split.target.size": 134217728},
- "current-snapshot-id": 3055729675574597004,
- "snapshots": [
- {
- "snapshot-id": 3051729675574597004,
- "timestamp-ms": 1515100955770,
- "sequence-number": 0,
- "summary": {"operation": "append"},
- "manifest-list": "s3://a/b/1.avro",
- },
- {
- "snapshot-id": 3055729675574597004,
- "parent-snapshot-id": 3051729675574597004,
- "timestamp-ms": 1555100955770,
- "sequence-number": 1,
- "summary": {"operation": "append"},
- "manifest-list": "s3://a/b/2.avro",
- "schema-id": 1,
- },
- ],
- "snapshot-log": [
- {"snapshot-id": 3051729675574597004, "timestamp-ms": 1515100955770},
- {"snapshot-id": 3055729675574597004, "timestamp-ms": 1555100955770},
- ],
- "metadata-log": [{"metadata-file": "s3://bucket/.../v1.json",
"timestamp-ms": 1515100}],
- "refs": {"test": {"snapshot-id": 3051729675574597004, "type": "tag",
"max-ref-age-ms": 10000000}},
-}
-
-
-class MockCatalog(Catalog):
- def create_table(
- self,
- identifier: Union[str, Identifier],
- schema: Schema,
- location: Optional[str] = None,
- partition_spec: PartitionSpec = UNPARTITIONED_PARTITION_SPEC,
- sort_order: SortOrder = UNSORTED_SORT_ORDER,
- properties: Properties = EMPTY_DICT,
- ) -> Table:
- return Table(
- identifier=Catalog.identifier_to_tuple(identifier),
- metadata_location="s3://tmp/",
- metadata=TableMetadataV2(**EXAMPLE_TABLE_METADATA_V2),
- io=load_file_io(),
- catalog=self,
- )
-
- def _commit_table(self, table_request: CommitTableRequest) ->
CommitTableResponse:
- raise NotImplementedError
-
- def load_table(self, identifier: Union[str, Identifier]) -> Table:
- tuple_identifier = Catalog.identifier_to_tuple(identifier)
- if tuple_identifier == ("default", "foo"):
- return Table(
- identifier=tuple_identifier,
- metadata_location="s3://tmp/",
- metadata=TableMetadataV2(**EXAMPLE_TABLE_METADATA_V2),
- io=load_file_io(),
- catalog=NoopCatalog("NoopCatalog"),
- )
- else:
- raise NoSuchTableError(f"Table does not exist:
{'.'.join(tuple_identifier)}")
-
- def drop_table(self, identifier: Union[str, Identifier]) -> None:
- tuple_identifier = Catalog.identifier_to_tuple(identifier)
- if tuple_identifier == ("default", "foo"):
- return None
- else:
- raise NoSuchTableError(f"Table does not exist: {identifier}")
-
- def purge_table(self, identifier: Union[str, Identifier]) -> None:
- self.drop_table(identifier)
-
- def rename_table(self, from_identifier: Union[str, Identifier],
to_identifier: Union[str, Identifier]) -> Table:
- tuple_identifier = Catalog.identifier_to_tuple(from_identifier)
- if tuple_identifier == ("default", "foo"):
- return Table(
- identifier=tuple_identifier,
- metadata_location="s3://tmp/",
- metadata=TableMetadataV2(**EXAMPLE_TABLE_METADATA_V2),
- io=load_file_io(),
- catalog=NoopCatalog("NoopCatalog"),
- )
- else:
- raise NoSuchTableError(f"Table does not exist: {from_identifier}")
-
- def create_namespace(self, namespace: Union[str, Identifier], properties:
Properties = EMPTY_DICT) -> None:
- return None
-
- def drop_namespace(self, namespace: Union[str, Identifier]) -> None:
- tuple_identifier = Catalog.identifier_to_tuple(namespace)
- if tuple_identifier == ("default",):
- return None
- else:
- raise NoSuchNamespaceError(f"Namespace does not exist:
{namespace}")
-
- def list_tables(self, namespace: Union[str, Identifier]) ->
List[Identifier]:
- return [
- ("default", "foo"),
- ("default", "bar"),
- ]
-
- def list_namespaces(self, namespace: Union[str, Identifier] = ()) ->
List[Identifier]:
- # No hierarchical namespaces for now
- if namespace == ():
- return [("default",), ("personal",)]
- else:
- return []
-
- def load_namespace_properties(self, namespace: Union[str, Identifier]) ->
Properties:
- identifier = Catalog.identifier_to_tuple(namespace)
- if identifier == ("default",):
- return {"location": "s3://warehouse/database/location"}
- else:
- raise NoSuchNamespaceError(f"Namespace does not exist:
{'.'.join(namespace)}")
-
- def update_namespace_properties(
- self, namespace: Union[str, Identifier], removals: Optional[Set[str]]
= None, updates: Properties = EMPTY_DICT
- ) -> PropertiesUpdateSummary:
- identifier = Catalog.identifier_to_tuple(namespace)
-
- if identifier == ("default",):
- return PropertiesUpdateSummary(removed=["location"], updated=[],
missing=[])
- else:
- raise NoSuchNamespaceError(f"Namespace does not exist:
{namespace}")
-
-
-MOCK_CATALOG = MockCatalog("production", uri="http://somewhere")
-MOCK_ENVIRONMENT = {"PYICEBERG_CATALOG__PRODUCTION__URI":
"test://doesnotexist"}
+from tests.catalog.test_base import InMemoryCatalog
-def test_missing_uri(empty_home_dir_path: str) -> None:
+def test_missing_uri(mocker: MockFixture, empty_home_dir_path: str) -> None:
# mock to prevent parsing ~/.pyiceberg.yaml or
{PYICEBERG_HOME}/.pyiceberg.yaml
- with mock.patch.dict(os.environ, {"HOME": empty_home_dir_path,
"PYICEBERG_HOME": empty_home_dir_path}):
- with mock.patch("pyiceberg.catalog._ENV_CONFIG", Config()):
- runner = CliRunner()
- result = runner.invoke(run, ["list"])
- assert result.exit_code == 1
- assert (
- result.output
- == "URI missing, please provide using --uri, the config or
environment variable \nPYICEBERG_CATALOG__DEFAULT__URI\n"
- )
+ mocker.patch.dict(os.environ, values={"HOME": empty_home_dir_path,
"PYICEBERG_HOME": empty_home_dir_path})
+ mocker.patch("pyiceberg.catalog._ENV_CONFIG", return_value=Config())
+
+ runner = CliRunner()
+ result = runner.invoke(run, ["list"])
+
+ assert result.exit_code == 1
+ assert result.output == "Could not initialize catalog with the following
properties: {}\n"
+
+
[email protected](autouse=True)
+def env_vars(mocker: MockFixture) -> None:
+ mocker.patch.dict(os.environ, MOCK_ENVIRONMENT)
+
+
[email protected](name="catalog")
+def fixture_catalog(mocker: MockFixture) -> InMemoryCatalog:
+ in_memory_catalog = InMemoryCatalog("test.in.memory.catalog",
**{"test.key": "test.value"})
+ mocker.patch("pyiceberg.cli.console.load_catalog",
return_value=in_memory_catalog)
+ return in_memory_catalog
+
+
[email protected](name="namespace_properties")
+def fixture_namespace_properties() -> Properties:
+ return TEST_NAMESPACE_PROPERTIES.copy()
+
+
+TEST_TABLE_IDENTIFIER = ("default", "my_table")
+TEST_TABLE_NAMESPACE = "default"
+TEST_NAMESPACE_PROPERTIES = {"location": "s3://warehouse/database/location"}
+TEST_TABLE_NAME = "my_table"
+TEST_TABLE_SCHEMA = Schema(schema_id=0)
+TEST_TABLE_LOCATION = "protocol://some/location"
+TEST_TABLE_PARTITION_SPEC = PartitionSpec(PartitionField(name="x",
transform=IdentityTransform(), source_id=1, field_id=1000))
+TEST_TABLE_PROPERTIES = {"read.split.target.size": "134217728"}
+MOCK_ENVIRONMENT = {"PYICEBERG_CATALOG__PRODUCTION__URI":
"test://doesnotexist"}
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_list_root(_: MockCatalog) -> None:
+def test_list_root(catalog: InMemoryCatalog) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE)
+
runner = CliRunner()
result = runner.invoke(run, ["list"])
+
assert result.exit_code == 0
- assert result.output == "default \npersonal\n"
+ assert TEST_TABLE_NAMESPACE in result.output
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_list_namespace(_: MockCatalog) -> None:
+def test_list_namespace(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ properties=TEST_TABLE_PROPERTIES,
+ )
+
runner = CliRunner()
result = runner.invoke(run, ["list", "default"])
+
assert result.exit_code == 0
- assert result.output == "default.foo\ndefault.bar\n"
+ assert result.output == "default.my_table\n"
+
+def test_describe_namespace(catalog: InMemoryCatalog, namespace_properties:
Properties) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE, namespace_properties)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_describe_namespace(_: MockCatalog) -> None:
runner = CliRunner()
result = runner.invoke(run, ["describe", "default"])
+
assert result.exit_code == 0
assert result.output == "location s3://warehouse/database/location\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_describe_namespace_does_not_exists(_: MockCatalog) -> None:
+def test_describe_namespace_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["describe", "doesnotexist"])
+
assert result.exit_code == 1
- assert result.output == "Namespace does not exist: doesnotexist\n"
+ assert result.output == "Namespace does not exist: ('doesnotexist',)\n"
+
+def test_describe_table(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_describe_table(_: MockCatalog) -> None:
runner = CliRunner()
- result = runner.invoke(run, ["describe", "default.foo"])
+ result = runner.invoke(run, ["describe", "default.my_table"])
assert result.exit_code == 0
assert (
# Strip the whitespace on the end
"\n".join([line.rstrip() for line in result.output.split("\n")])
- == """Table format version 2
-Metadata location s3://tmp/
-Table UUID 9c12d441-03fe-4693-9a96-a0705ddf69c1
-Last Updated 1602638573590
+ == """Table format version 1
+Metadata location s3://warehouse/default/my_table/metadata/metadata.json
+Table UUID d20125c8-7284-442c-9aea-15fee620737c
+Last Updated 1602638573874
Partition spec [
1000: x: identity(1)
]
-Sort order [
- 2 ASC NULLS FIRST
- bucket[4](3) DESC NULLS LAST
- ]
-Current schema Schema, id=1
+Sort order []
+Current schema Schema, id=0
├── 1: x: required long
├── 2: y: required long (comment)
└── 3: z: required long
-Current snapshot Operation.APPEND: id=3055729675574597004,
- parent_id=3051729675574597004, schema_id=1
+Current snapshot None
Snapshots Snapshots
- ├── Snapshot 3051729675574597004, schema None:
- │ s3://a/b/1.avro
- └── Snapshot 3055729675574597004, schema 1:
- s3://a/b/2.avro
-Properties read.split.target.size 134217728
+ └── Snapshot 1925, schema None
+Properties
"""
)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_describe_table_does_not_exists(_: MockCatalog) -> None:
+def test_describe_table_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
- result = runner.invoke(run, ["describe", "default.doesnotexit"])
+ result = runner.invoke(run, ["describe", "default.doesnotexist"])
assert result.exit_code == 1
- assert result.output == "Table or namespace does not exist:
default.doesnotexit\n"
+ assert result.output == "Table or namespace does not exist:
default.doesnotexist\n"
+
+def test_schema(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_schema(_: MockCatalog) -> None:
runner = CliRunner()
- result = runner.invoke(run, ["schema", "default.foo"])
+ result = runner.invoke(run, ["schema", "default.my_table"])
assert result.exit_code == 0
assert (
"\n".join([line.rstrip() for line in result.output.split("\n")])
@@ -312,20 +178,25 @@ z long
)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_schema_does_not_exists(_: MockCatalog) -> None:
+def test_schema_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
- result = runner.invoke(run, ["schema", "default.doesnotexit"])
+ result = runner.invoke(run, ["schema", "default.doesnotexist"])
assert result.exit_code == 1
- assert result.output == "Table does not exist: default.doesnotexit\n"
+ assert result.output == "Table does not exist: ('default',
'doesnotexist')\n"
+
+def test_spec(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_spec(_: MockCatalog) -> None:
runner = CliRunner()
- result = runner.invoke(run, ["spec", "default.foo"])
+ result = runner.invoke(run, ["spec", "default.my_table"])
assert result.exit_code == 0
assert (
result.output
@@ -336,334 +207,409 @@ def test_spec(_: MockCatalog) -> None:
)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_spec_does_not_exists(_: MockCatalog) -> None:
+def test_spec_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
- result = runner.invoke(run, ["spec", "default.doesnotexit"])
+ result = runner.invoke(run, ["spec", "default.doesnotexist"])
assert result.exit_code == 1
- assert result.output == "Table does not exist: default.doesnotexit\n"
+ assert result.output == "Table does not exist: ('default',
'doesnotexist')\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_uuid(_: MockCatalog) -> None:
+def test_uuid(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["uuid", "default.foo"])
+ result = runner.invoke(run, ["uuid", "default.my_table"])
assert result.exit_code == 0
- assert result.output == """9c12d441-03fe-4693-9a96-a0705ddf69c1\n"""
+ assert result.output == """d20125c8-7284-442c-9aea-15fee620737c\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_uuid_does_not_exists(_: MockCatalog) -> None:
+def test_uuid_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
- result = runner.invoke(run, ["uuid", "default.doesnotexit"])
+ result = runner.invoke(run, ["uuid", "default.doesnotexist"])
assert result.exit_code == 1
- assert result.output == "Table does not exist: default.doesnotexit\n"
+ assert result.output == "Table does not exist: ('default',
'doesnotexist')\n"
+
+def test_location(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_location(_: MockCatalog) -> None:
runner = CliRunner()
- result = runner.invoke(run, ["location", "default.foo"])
+ result = runner.invoke(run, ["location", "default.my_table"])
assert result.exit_code == 0
assert result.output == """s3://bucket/test/location\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_location_does_not_exists(_: MockCatalog) -> None:
+def test_location_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
- result = runner.invoke(run, ["location", "default.doesnotexit"])
+ result = runner.invoke(run, ["location", "default.doesnotexist"])
assert result.exit_code == 1
- assert result.output == "Table does not exist: default.doesnotexit\n"
+ assert result.output == "Table does not exist: ('default',
'doesnotexist')\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_drop_table(_: MockCatalog) -> None:
+def test_drop_table(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["drop", "table", "default.foo"])
+ result = runner.invoke(run, ["drop", "table", "default.my_table"])
assert result.exit_code == 0
- assert result.output == """Dropped table: default.foo\n"""
+ assert result.output == """Dropped table: default.my_table\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_drop_table_does_not_exists(_: MockCatalog) -> None:
+def test_drop_table_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
- result = runner.invoke(run, ["drop", "table", "default.doesnotexit"])
+ result = runner.invoke(run, ["drop", "table", "default.doesnotexist"])
assert result.exit_code == 1
- assert result.output == "Table does not exist: default.doesnotexit\n"
+ assert result.output == "Table does not exist: ('default',
'doesnotexist')\n"
+
+def test_drop_namespace(catalog: InMemoryCatalog) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_drop_namespace(_: MockCatalog) -> None:
runner = CliRunner()
result = runner.invoke(run, ["drop", "namespace", "default"])
assert result.exit_code == 0
assert result.output == """Dropped namespace: default\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_drop_namespace_does_not_exists(_: MockCatalog) -> None:
+def test_drop_namespace_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
- result = runner.invoke(run, ["drop", "namespace", "doesnotexit"])
+ result = runner.invoke(run, ["drop", "namespace", "doesnotexist"])
assert result.exit_code == 1
- assert result.output == "Namespace does not exist: doesnotexit\n"
+ assert result.output == "Namespace does not exist: ('doesnotexist',)\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_rename_table(_: MockCatalog) -> None:
+def test_rename_table(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["rename", "default.foo", "default.bar"])
+ result = runner.invoke(run, ["rename", "default.my_table",
"default.my_new_table"])
assert result.exit_code == 0
- assert result.output == """Renamed table from default.foo to
default.bar\n"""
+ assert result.output == """Renamed table from default.my_table to
default.my_new_table\n"""
+
+def test_rename_table_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_rename_table_does_not_exists(_: MockCatalog) -> None:
runner = CliRunner()
- result = runner.invoke(run, ["rename", "default.doesnotexit",
"default.bar"])
+ result = runner.invoke(run, ["rename", "default.doesnotexist",
"default.bar"])
assert result.exit_code == 1
- assert result.output == "Table does not exist: default.doesnotexit\n"
+ assert result.output == "Table does not exist: ('default',
'doesnotexist')\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_get_table(_: MockCatalog) -> None:
+def test_properties_get_table(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ properties=TEST_TABLE_PROPERTIES,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["properties", "get", "table", "default.foo"])
+ result = runner.invoke(run, ["properties", "get", "table",
"default.my_table"])
assert result.exit_code == 0
assert result.output == "read.split.target.size 134217728\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_get_table_specific_property(_: MockCatalog) -> None:
+def test_properties_get_table_specific_property(catalog: InMemoryCatalog) ->
None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ properties=TEST_TABLE_PROPERTIES,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["properties", "get", "table", "default.foo",
"read.split.target.size"])
+ result = runner.invoke(run, ["properties", "get", "table",
"default.my_table", "read.split.target.size"])
assert result.exit_code == 0
assert result.output == "134217728\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_get_table_specific_property_that_doesnt_exist(_:
MockCatalog) -> None:
+def test_properties_get_table_specific_property_that_doesnt_exist(catalog:
InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ properties=TEST_TABLE_PROPERTIES,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["properties", "get", "table", "default.foo",
"doesnotexist"])
+ result = runner.invoke(run, ["properties", "get", "table",
"default.my_table", "doesnotexist"])
assert result.exit_code == 1
- assert result.output == "Could not find property doesnotexist on table
default.foo\n"
+ assert result.output == "Could not find property doesnotexist on table
default.my_table\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_get_table_does_not_exist(_: MockCatalog) -> None:
+def test_properties_get_table_does_not_exist(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["properties", "get", "table", "doesnotexist"])
assert result.exit_code == 1
- assert result.output == "Table does not exist: doesnotexist\n"
+ assert result.output == "Table does not exist: ('doesnotexist',)\n"
+
+def test_properties_get_namespace(catalog: InMemoryCatalog,
namespace_properties: Properties) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE, namespace_properties)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_get_namespace(_: MockCatalog) -> None:
runner = CliRunner()
result = runner.invoke(run, ["properties", "get", "namespace", "default"])
assert result.exit_code == 0
assert result.output == "location s3://warehouse/database/location\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_get_namespace_specific_property(_: MockCatalog) -> None:
+def test_properties_get_namespace_specific_property(catalog: InMemoryCatalog,
namespace_properties: Properties) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE, namespace_properties)
+
runner = CliRunner()
result = runner.invoke(run, ["properties", "get", "namespace", "default",
"location"])
assert result.exit_code == 0
assert result.output == "s3://warehouse/database/location\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_get_namespace_does_not_exist(_: MockCatalog) -> None:
+def test_properties_get_namespace_does_not_exist(catalog: InMemoryCatalog,
namespace_properties: Properties) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE, namespace_properties)
+
runner = CliRunner()
result = runner.invoke(run, ["properties", "get", "namespace",
"doesnotexist"])
assert result.exit_code == 1
- assert result.output == "Namespace does not exist: doesnotexist\n"
+ assert result.output == "Namespace does not exist: ('doesnotexist',)\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_set_namespace(_: MockCatalog) -> None:
+def test_properties_set_namespace(catalog: InMemoryCatalog,
namespace_properties: Properties) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE, namespace_properties)
+
runner = CliRunner()
result = runner.invoke(run, ["properties", "set", "namespace", "default",
"location", "s3://new_location"])
assert result.exit_code == 0
assert result.output == "Updated location on default\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_set_namespace_that_doesnt_exist(_: MockCatalog) -> None:
+def test_properties_set_namespace_that_doesnt_exist(catalog: InMemoryCatalog)
-> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["properties", "set", "namespace",
"doesnotexist", "location", "s3://new_location"])
assert result.exit_code == 1
- assert result.output == "Namespace does not exist: doesnotexist\n"
+ assert result.output == "Namespace does not exist: ('doesnotexist',)\n"
+
+def test_properties_set_table(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_set_table(_: MockCatalog) -> None:
runner = CliRunner()
- result = runner.invoke(run, ["properties", "set", "table", "default.foo",
"location", "s3://new_location"])
+ result = runner.invoke(run, ["properties", "set", "table",
"default.my_table", "location", "s3://new_location"])
assert result.exit_code == 1
assert "Writing is WIP" in result.output
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_set_table_does_not_exist(_: MockCatalog) -> None:
+def test_properties_set_table_does_not_exist(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["properties", "set", "table",
"default.doesnotexist", "location", "s3://new_location"])
assert result.exit_code == 1
- assert result.output == "Table does not exist: default.doesnotexist\n"
+ assert result.output == "Table does not exist: ('default',
'doesnotexist')\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_remove_namespace(_: MockCatalog) -> None:
+def test_properties_remove_namespace(catalog: InMemoryCatalog,
namespace_properties: Properties) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE, namespace_properties)
+
runner = CliRunner()
result = runner.invoke(run, ["properties", "remove", "namespace",
"default", "location"])
assert result.exit_code == 0
assert result.output == "Property location removed from default\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_remove_namespace_that_doesnt_exist(_: MockCatalog) -> None:
+def test_properties_remove_namespace_that_doesnt_exist(catalog:
InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["properties", "remove", "namespace",
"doesnotexist", "location"])
assert result.exit_code == 1
- assert result.output == "Namespace does not exist: doesnotexist\n"
+ assert result.output == "Namespace does not exist: ('doesnotexist',)\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_remove_table(_: MockCatalog) -> None:
+def test_properties_remove_table(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ properties=TEST_TABLE_PROPERTIES,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["properties", "remove", "table",
"default.foo", "read.split.target.size"])
+ result = runner.invoke(run, ["properties", "remove", "table",
"default.my_table", "read.split.target.size"])
assert result.exit_code == 1
assert result.output == "Writing is WIP\n1\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_remove_table_property_does_not_exists(_: MockCatalog) ->
None:
+def test_properties_remove_table_property_does_not_exists(catalog:
InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["properties", "remove", "table",
"default.foo", "doesnotexist"])
+ result = runner.invoke(run, ["properties", "remove", "table",
"default.my_table", "doesnotexist"])
assert result.exit_code == 1
- assert result.output == "Property doesnotexist does not exist on
default.foo\n"
+ assert result.output == "Property doesnotexist does not exist on
default.my_table\n"
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_properties_remove_table_does_not_exist(_: MockCatalog) -> None:
+def test_properties_remove_table_does_not_exist(catalog: InMemoryCatalog) ->
None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["properties", "remove", "table",
"default.doesnotexist", "location"])
assert result.exit_code == 1
- assert result.output == "Table does not exist: default.doesnotexist\n"
+ assert result.output == "Table does not exist: ('default',
'doesnotexist')\n"
+
+def test_json_list_root(catalog: InMemoryCatalog) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_list_root(_: MockCatalog) -> None:
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "list"])
assert result.exit_code == 0
- assert result.output == """["default", "personal"]\n"""
+ assert result.output == """["default"]\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_list_namespace(_: MockCatalog) -> None:
+def test_json_list_namespace(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "list", "default"])
assert result.exit_code == 0
- assert result.output == """["default.foo", "default.bar"]\n"""
+ assert result.output == """["default.my_table"]\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_describe_namespace(_: MockCatalog) -> None:
+def test_json_describe_namespace(catalog: InMemoryCatalog,
namespace_properties: Properties) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE, namespace_properties)
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "describe", "default"])
assert result.exit_code == 0
assert result.output == """{"location":
"s3://warehouse/database/location"}\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_describe_namespace_does_not_exists(_: MockCatalog) -> None:
+def test_json_describe_namespace_does_not_exists(catalog: InMemoryCatalog) ->
None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "describe", "doesnotexist"])
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchNamespaceError", "message":
"Namespace does not exist: doesnotexist"}\n"""
+ assert result.output == """{"type": "NoSuchNamespaceError", "message":
"Namespace does not exist: ('doesnotexist',)"}\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_describe_table(_: MockCatalog) -> None:
+def test_json_describe_table(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "describe", "default.foo"])
+ result = runner.invoke(run, ["--output=json", "describe",
"default.my_table"])
assert result.exit_code == 0
assert (
result.output
- == """{"identifier": ["default", "foo"], "metadata_location":
"s3://tmp/", "metadata": {"location": "s3://bucket/test/location",
"table-uuid": "9c12d441-03fe-4693-9a96-a0705ddf69c1", "last-updated-ms":
1602638573590, "last-column-id": 3, "schemas": [{"type": "struct", "fields":
[{"id": 1, "name": "x", "type": "long", "required": true}], "schema-id": 0,
"identifier-field-ids": []}, {"type": "struct", "fields": [{"id": 1, "name":
"x", "type": "long", "required": true}, {"id": 2, "n [...]
+ == """{"identifier": ["default", "my_table"], "metadata_location":
"s3://warehouse/default/my_table/metadata/metadata.json", "metadata":
{"location": "s3://bucket/test/location", "table-uuid":
"d20125c8-7284-442c-9aea-15fee620737c", "last-updated-ms": 1602638573874,
"last-column-id": 3, "schemas": [{"type": "struct", "fields": [{"id": 1,
"name": "x", "type": "long", "required": true}, {"id": 2, "name": "y", "type":
"long", "required": true, "doc": "comment"}, {"id": 3, "name": "z [...]
)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_describe_table_does_not_exists(_: MockCatalog) -> None:
+def test_json_describe_table_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "describe",
"default.doesnotexit"])
+ result = runner.invoke(run, ["--output=json", "describe",
"default.doesnotexist"])
assert result.exit_code == 1
assert (
- result.output == """{"type": "NoSuchTableError", "message": "Table or
namespace does not exist: default.doesnotexit"}\n"""
+ result.output
+ == """{"type": "NoSuchTableError", "message": "Table or namespace does
not exist: default.doesnotexist"}\n"""
)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_schema(_: MockCatalog) -> None:
+def test_json_schema(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "schema", "default.foo"])
+ result = runner.invoke(run, ["--output=json", "schema",
"default.my_table"])
assert result.exit_code == 0
assert (
result.output
- == """{"type": "struct", "fields": [{"id": 1, "name": "x", "type":
"long", "required": true}, {"id": 2, "name": "y", "type": "long", "required":
true, "doc": "comment"}, {"id": 3, "name": "z", "type": "long", "required":
true}], "schema-id": 1, "identifier-field-ids": [1, 2]}\n"""
+ == """{"type": "struct", "fields": [{"id": 1, "name": "x", "type":
"long", "required": true}, {"id": 2, "name": "y", "type": "long", "required":
true, "doc": "comment"}, {"id": 3, "name": "z", "type": "long", "required":
true}], "schema-id": 0, "identifier-field-ids": []}\n"""
)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_schema_does_not_exists(_: MockCatalog) -> None:
+def test_json_schema_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "schema",
"default.doesnotexit"])
+ result = runner.invoke(run, ["--output=json", "schema",
"default.doesnotexist"])
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: default.doesnotexit"}\n"""
+ assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: ('default', 'doesnotexist')"}\n"""
+
+def test_json_spec(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_spec(_: MockCatalog) -> None:
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "spec", "default.foo"])
+ result = runner.invoke(run, ["--output=json", "spec", "default.my_table"])
assert result.exit_code == 0
assert (
result.output
@@ -671,254 +617,312 @@ def test_json_spec(_: MockCatalog) -> None:
)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_spec_does_not_exists(_: MockCatalog) -> None:
+def test_json_spec_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "spec",
"default.doesnotexit"])
+ result = runner.invoke(run, ["--output=json", "spec",
"default.doesnotexist"])
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: default.doesnotexit"}\n"""
+ assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: ('default', 'doesnotexist')"}\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_uuid(_: MockCatalog) -> None:
+def test_json_uuid(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "uuid", "default.foo"])
+ result = runner.invoke(run, ["--output=json", "uuid", "default.my_table"])
assert result.exit_code == 0
- assert result.output == """{"uuid":
"9c12d441-03fe-4693-9a96-a0705ddf69c1"}\n"""
+ assert result.output == """{"uuid":
"d20125c8-7284-442c-9aea-15fee620737c"}\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_uuid_does_not_exists(_: MockCatalog) -> None:
+def test_json_uuid_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "uuid",
"default.doesnotexit"])
+ result = runner.invoke(run, ["--output=json", "uuid",
"default.doesnotexist"])
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: default.doesnotexit"}\n"""
+ assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: ('default', 'doesnotexist')"}\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_location(_: MockCatalog) -> None:
+def test_json_location(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "location", "default.foo"])
+ result = runner.invoke(run, ["--output=json", "location",
"default.my_table"])
assert result.exit_code == 0
assert result.output == """"s3://bucket/test/location"\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_location_does_not_exists(_: MockCatalog) -> None:
+def test_json_location_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "location",
"default.doesnotexist"])
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: default.doesnotexist"}\n"""
+ assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: ('default', 'doesnotexist')"}\n"""
+
+def test_json_drop_table(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_drop_table(_: MockCatalog) -> None:
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "drop", "table",
"default.foo"])
+ result = runner.invoke(run, ["--output=json", "drop", "table",
"default.my_table"])
assert result.exit_code == 0
- assert result.output == """"Dropped table: default.foo"\n"""
+ assert result.output == """"Dropped table: default.my_table"\n"""
+
+def test_json_drop_table_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_drop_table_does_not_exists(_: MockCatalog) -> None:
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "drop", "table",
"default.doesnotexist"])
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: default.doesnotexist"}\n"""
+ assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: ('default', 'doesnotexist')"}\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_drop_namespace(_: MockCatalog) -> None:
+def test_json_drop_namespace(catalog: InMemoryCatalog) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE)
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "drop", "namespace",
"default"])
assert result.exit_code == 0
assert result.output == """"Dropped namespace: default"\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_drop_namespace_does_not_exists(_: MockCatalog) -> None:
+def test_json_drop_namespace_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "drop", "namespace",
"doesnotexist"])
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchNamespaceError", "message":
"Namespace does not exist: doesnotexist"}\n"""
+ assert result.output == """{"type": "NoSuchNamespaceError", "message":
"Namespace does not exist: ('doesnotexist',)"}\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_rename_table(_: MockCatalog) -> None:
+def test_json_rename_table(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "rename", "default.foo",
"default.bar"])
+ result = runner.invoke(run, ["--output=json", "rename",
"default.my_table", "default.my_new_table"])
assert result.exit_code == 0
- assert result.output == """"Renamed table from default.foo to
default.bar"\n"""
+ assert result.output == """"Renamed table from default.my_table to
default.my_new_table"\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_rename_table_does_not_exists(_: MockCatalog) -> None:
+def test_json_rename_table_does_not_exists(catalog: InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "rename",
"default.doesnotexit", "default.bar"])
+ result = runner.invoke(run, ["--output=json", "rename",
"default.doesnotexist", "default.bar"])
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: default.doesnotexit"}\n"""
+ assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: ('default', 'doesnotexist')"}\n"""
+
+def test_json_properties_get_table(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ properties=TEST_TABLE_PROPERTIES,
+ )
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_get_table(_: MockCatalog) -> None:
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "properties", "get",
"table", "default.foo"])
+ result = runner.invoke(run, ["--output=json", "properties", "get",
"table", "default.my_table"])
assert result.exit_code == 0
assert result.output == """{"read.split.target.size": "134217728"}\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_get_table_specific_property(_: MockCatalog) -> None:
+def test_json_properties_get_table_specific_property(catalog: InMemoryCatalog)
-> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ properties=TEST_TABLE_PROPERTIES,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "properties", "get",
"table", "default.foo", "read.split.target.size"])
+ result = runner.invoke(run, ["--output=json", "properties", "get",
"table", "default.my_table", "read.split.target.size"])
assert result.exit_code == 0
assert result.output == """"134217728"\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_get_table_specific_property_that_doesnt_exist(_:
MockCatalog) -> None:
+def
test_json_properties_get_table_specific_property_that_doesnt_exist(catalog:
InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ properties=TEST_TABLE_PROPERTIES,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "properties", "get",
"table", "default.foo", "doesnotexist"])
+ result = runner.invoke(run, ["--output=json", "properties", "get",
"table", "default.my_table", "doesnotexist"])
assert result.exit_code == 1
assert (
result.output
- == """{"type": "NoSuchPropertyException", "message": "Could not find
property doesnotexist on table default.foo"}\n"""
+ == """{"type": "NoSuchPropertyException", "message": "Could not find
property doesnotexist on table default.my_table"}\n"""
)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_get_table_does_not_exist(_: MockCatalog) -> None:
+def test_json_properties_get_table_does_not_exist(catalog: InMemoryCatalog) ->
None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "properties", "get",
"table", "doesnotexist"])
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: doesnotexist"}\n"""
+ assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: ('doesnotexist',)"}\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_get_namespace(_: MockCatalog) -> None:
+def test_json_properties_get_namespace(catalog: InMemoryCatalog,
namespace_properties: Properties) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE, namespace_properties)
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "properties", "get",
"namespace", "default"])
assert result.exit_code == 0
assert result.output == """{"location":
"s3://warehouse/database/location"}\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_get_namespace_specific_property(_: MockCatalog) ->
None:
+def test_json_properties_get_namespace_specific_property(catalog:
InMemoryCatalog, namespace_properties: Properties) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE, namespace_properties)
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "properties", "get",
"namespace", "default", "location"])
assert result.exit_code == 0
assert result.output == """"s3://warehouse/database/location"\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_get_namespace_does_not_exist(_: MockCatalog) -> None:
+def test_json_properties_get_namespace_does_not_exist(catalog:
InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "properties", "get",
"namespace", "doesnotexist"])
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchNamespaceError", "message":
"Namespace does not exist: doesnotexist"}\n"""
+ assert result.output == """{"type": "NoSuchNamespaceError", "message":
"Namespace does not exist: ('doesnotexist',)"}\n"""
+
+def test_json_properties_set_namespace(catalog: InMemoryCatalog,
namespace_properties: Properties) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE, namespace_properties)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_set_namespace(_: MockCatalog) -> None:
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "properties", "set",
"namespace", "default", "location", "s3://new_location"])
assert result.exit_code == 0
assert result.output == """"Updated location on default"\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_set_namespace_that_doesnt_exist(_: MockCatalog) ->
None:
+def test_json_properties_set_namespace_that_doesnt_exist(catalog:
InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(
run, ["--output=json", "properties", "set", "namespace",
"doesnotexist", "location", "s3://new_location"]
)
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchNamespaceError", "message":
"Namespace does not exist: doesnotexist"}\n"""
+ assert result.output == """{"type": "NoSuchNamespaceError", "message":
"Namespace does not exist: ('doesnotexist',)"}\n"""
+
+def test_json_properties_set_table(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ properties=TEST_TABLE_PROPERTIES,
+ )
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_set_table(_: MockCatalog) -> None:
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "properties", "set",
"table", "default.foo", "location", "s3://new_location"])
+ result = runner.invoke(
+ run, ["--output=json", "properties", "set", "table",
"default.my_table", "location", "s3://new_location"]
+ )
assert result.exit_code == 1
assert "Writing is WIP" in result.output
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_set_table_does_not_exist(_: MockCatalog) -> None:
+def test_json_properties_set_table_does_not_exist(catalog: InMemoryCatalog) ->
None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(
run, ["--output=json", "properties", "set", "table",
"default.doesnotexist", "location", "s3://new_location"]
)
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: default.doesnotexist"}\n"""
+ assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: ('default', 'doesnotexist')"}\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_remove_namespace(_: MockCatalog) -> None:
+def test_json_properties_remove_namespace(catalog: InMemoryCatalog,
namespace_properties: Properties) -> None:
+ catalog.create_namespace(TEST_TABLE_NAMESPACE, namespace_properties)
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "properties", "remove",
"namespace", "default", "location"])
assert result.exit_code == 0
assert result.output == """"Property location removed from default"\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_remove_namespace_that_doesnt_exist(_: MockCatalog) ->
None:
+def test_json_properties_remove_namespace_that_doesnt_exist(catalog:
InMemoryCatalog) -> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "properties", "remove",
"namespace", "doesnotexist", "location"])
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchNamespaceError", "message":
"Namespace does not exist: doesnotexist"}\n"""
+ assert result.output == """{"type": "NoSuchNamespaceError", "message":
"Namespace does not exist: ('doesnotexist',)"}\n"""
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_remove_table(_: MockCatalog) -> None:
+def test_json_properties_remove_table(catalog: InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ properties=TEST_TABLE_PROPERTIES,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "properties", "remove",
"table", "default.foo", "read.split.target.size"])
+ result = runner.invoke(run, ["--output=json", "properties", "remove",
"table", "default.my_table", "read.split.target.size"])
assert result.exit_code == 1
assert "Writing is WIP" in result.output
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_remove_table_property_does_not_exists(_: MockCatalog)
-> None:
+def test_json_properties_remove_table_property_does_not_exists(catalog:
InMemoryCatalog) -> None:
+ catalog.create_table(
+ identifier=TEST_TABLE_IDENTIFIER,
+ schema=TEST_TABLE_SCHEMA,
+ location=TEST_TABLE_LOCATION,
+ partition_spec=TEST_TABLE_PARTITION_SPEC,
+ properties=TEST_TABLE_PROPERTIES,
+ )
+
runner = CliRunner()
- result = runner.invoke(run, ["--output=json", "properties", "remove",
"table", "default.foo", "doesnotexist"])
+ result = runner.invoke(run, ["--output=json", "properties", "remove",
"table", "default.my_table", "doesnotexist"])
assert result.exit_code == 1
assert (
result.output
- == """{"type": "NoSuchPropertyException", "message": "Property
doesnotexist does not exist on default.foo"}\n"""
+ == """{"type": "NoSuchPropertyException", "message": "Property
doesnotexist does not exist on default.my_table"}\n"""
)
[email protected](os.environ, MOCK_ENVIRONMENT)
[email protected]("pyiceberg.cli.console.load_catalog", return_value=MOCK_CATALOG)
-def test_json_properties_remove_table_does_not_exist(_: MockCatalog) -> None:
+def test_json_properties_remove_table_does_not_exist(catalog: InMemoryCatalog)
-> None:
+ # pylint: disable=unused-argument
+
runner = CliRunner()
result = runner.invoke(run, ["--output=json", "properties", "remove",
"table", "default.doesnotexist", "location"])
assert result.exit_code == 1
- assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: default.doesnotexist"}\n"""
+ assert result.output == """{"type": "NoSuchTableError", "message": "Table
does not exist: ('default', 'doesnotexist')"}\n"""