Skip to content

Commit efee633

Browse files
committed
Jac/release automation (#1613)
* update publish workflow * Update pyproject.toml and setup * add init files to find test_repr, fix it to pass
1 parent d5523ed commit efee633

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ repository = "https://github.com/tableau/server-client-python"
3434
[project.optional-dependencies]
3535
test = ["black==24.10", "build", "mypy==1.4", "pytest>=7.0", "pytest-cov", "pytest-subtests",
3636
"pytest-xdist", "requests-mock>=1.0,<2.0", "types-requests>=2.32.4.20250913"]
37+
38+
[tool.setuptools.packages.find]
39+
where = ["tableauserverclient", "tableauserverclient.helpers", "tableauserverclient.models", "tableauserverclient.server", "tableauserverclient.server.endpoint"]
40+
41+
[tool.setuptools.dynamic]
42+
version = {attr = "versioneer.get_version"}
43+
3744
[tool.black]
3845
line-length = 120
3946
target-version = ['py39', 'py310', 'py311', 'py312', 'py313']

test/models/test_repr.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import inspect
22
from typing import Any
3-
4-
import _models # type: ignore # did not set types for this
3+
from test.models._models import get_unimplemented_models
54
import tableauserverclient as TSC
65

76
import pytest
@@ -46,18 +45,4 @@ def try_instantiate_class(name: str, obj: Any) -> Any | None:
4645
return instance
4746
else:
4847
print(f"Class '{name}' does not have a constructor (__init__ method).")
49-
50-
51-
def is_concrete(obj: Any):
52-
return inspect.isclass(obj) and not inspect.isabstract(obj)
53-
54-
55-
@pytest.mark.parametrize("class_name, obj", inspect.getmembers(TSC, is_concrete))
56-
def test_by_reflection(class_name, obj):
57-
instantiate_class(class_name, obj)
58-
59-
60-
@pytest.mark.parametrize("model", _models.get_defined_models())
61-
def test_repr_is_implemented(model):
62-
print(model.__name__, type(model.__repr__).__name__)
63-
assert type(model.__repr__).__name__ == "function"
48+
return None

test/test_custom_view.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ def test_publish_filepath(server: TSC.Server) -> None:
175175
cv._owner = TSC.UserItem()
176176
cv._owner._id = "dd2239f6-ddf1-4107-981a-4cf94e415794"
177177
cv.workbook = TSC.WorkbookItem()
178+
assert cv.workbook is not None
178179
cv.workbook._id = "1f951daf-4061-451a-9df1-69a8062664f2"
179180
with requests_mock.mock() as m:
180181
m.post(server.custom_views.expurl, status_code=201, text=GET_XML.read_text())
@@ -191,6 +192,7 @@ def test_publish_file_str(server: TSC.Server) -> None:
191192
cv._owner = TSC.UserItem()
192193
cv._owner._id = "dd2239f6-ddf1-4107-981a-4cf94e415794"
193194
cv.workbook = TSC.WorkbookItem()
195+
assert cv.workbook is not None
194196
cv.workbook._id = "1f951daf-4061-451a-9df1-69a8062664f2"
195197
with requests_mock.mock() as m:
196198
m.post(server.custom_views.expurl, status_code=201, text=GET_XML.read_text())
@@ -207,6 +209,7 @@ def test_publish_file_io(server: TSC.Server) -> None:
207209
cv._owner = TSC.UserItem()
208210
cv._owner._id = "dd2239f6-ddf1-4107-981a-4cf94e415794"
209211
cv.workbook = TSC.WorkbookItem()
212+
assert cv.workbook is not None
210213
cv.workbook._id = "1f951daf-4061-451a-9df1-69a8062664f2"
211214
data = io.BytesIO(CUSTOM_VIEW_DOWNLOAD.read_bytes())
212215
with requests_mock.mock() as m:
@@ -223,6 +226,7 @@ def test_publish_missing_owner_id(server: TSC.Server) -> None:
223226
cv = TSC.CustomViewItem(name="test")
224227
cv._owner = TSC.UserItem()
225228
cv.workbook = TSC.WorkbookItem()
229+
assert cv.workbook is not None
226230
cv.workbook._id = "1f951daf-4061-451a-9df1-69a8062664f2"
227231
with requests_mock.mock() as m:
228232
m.post(server.custom_views.expurl, status_code=201, text=GET_XML.read_text())
@@ -246,6 +250,7 @@ def test_large_publish(server: TSC.Server):
246250
cv._owner = TSC.UserItem()
247251
cv._owner._id = "dd2239f6-ddf1-4107-981a-4cf94e415794"
248252
cv.workbook = TSC.WorkbookItem()
253+
assert cv.workbook is not None
249254
cv.workbook._id = "1f951daf-4061-451a-9df1-69a8062664f2"
250255
with ExitStack() as stack:
251256
temp_dir = stack.enter_context(TemporaryDirectory())

0 commit comments

Comments
 (0)