Skip to content

Commit f308791

Browse files
authored
Update to run only on currently supported python versions (#382)
2 parents 651887e + 48c7ce4 commit f308791

7 files changed

Lines changed: 36 additions & 25 deletions

File tree

.github/workflows/python-app.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
os: [ubuntu-latest, macos-latest, windows-latest]
21-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
21+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
2222

2323
runs-on: ${{ matrix.os }}
2424

.github/workflows/run-e2-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: true
1919
matrix:
2020
os: [ubuntu-latest, macos-latest, windows-latest]
21-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
21+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
2222

2323
runs-on: ${{ matrix.os }}
2424

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: true
1616
matrix:
1717
os: [ubuntu-latest, macos-latest, windows-latest]
18-
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
18+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
1919

2020
runs-on: ${{ matrix.os }}
2121

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ authors = [{name="Tableau", email="github@tableau.com"}]
3232
license = "MIT"
3333
license-files = ["LICENSE"]
3434
readme = "res/README.md"
35-
requires-python = ">=3.9" # https://devguide.python.org/versions/
35+
requires-python = ">=3.10" # https://devguide.python.org/versions/
3636
classifiers = [
3737
"Programming Language :: Python",
3838
"Programming Language :: Python :: 3",
39-
"Programming Language :: Python :: 3.9",
4039
"Programming Language :: Python :: 3.10",
4140
"Programming Language :: Python :: 3.11",
4241
"Programming Language :: Python :: 3.12",
43-
"Programming Language :: Python :: 3.13"
42+
"Programming Language :: Python :: 3.13",
43+
"Programming Language :: Python :: 3.14"
4444
]
4545
dependencies = [
4646
"appdirs",

tabcmd/commands/datasources_and_workbooks/publish_command.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,21 @@ def run_command(args):
6363

6464
publish_mode = PublishCommand.get_publish_mode(args, logger)
6565

66-
connection = TSC.models.ConnectionItem()
66+
# Build both forms: workbook "connections" (ConnectionItem) and datasource "connection_credentials"
67+
workbook_connections = None
68+
datasource_credentials = None
6769
if args.db_username:
68-
connection.connection_credentials = TSC.models.ConnectionCredentials(
69-
args.db_username, args.db_password, embed=args.save_db_password
70-
)
70+
creds = TSC.models.ConnectionCredentials(args.db_username, args.db_password, embed=args.save_db_password)
71+
workbook_connections = TSC.ConnectionItem()
72+
workbook_connections.connection_credentials = creds
73+
datasource_credentials = creds
7174
elif args.oauth_username:
72-
connection.connection_credentials = TSC.models.ConnectionCredentials(
73-
args.oauth_username, None, embed=False, oauth=args.save_oauth
74-
)
75+
creds = TSC.models.ConnectionCredentials(args.oauth_username, None, embed=False, oauth=args.save_oauth)
76+
workbook_connections = TSC.ConnectionItem()
77+
workbook_connections.connection_credentials = creds
78+
datasource_credentials = creds
7579
else:
7680
logger.debug("No db-username or oauth-username found in command")
77-
creds = None
78-
credentials = TSC.ConnectionItem() if creds else None
79-
if credentials:
80-
credentials.connection_credentials = creds
8181

8282
files = PublishCommand.get_files_to_publish(args, logger)
8383

@@ -94,7 +94,7 @@ def run_command(args):
9494
project_id=project_id,
9595
str_filename=str_filename,
9696
publish_mode=publish_mode,
97-
credentials=credentials,
97+
credentials=workbook_connections,
9898
)
9999
except Exception as e:
100100
Errors.exit_with_error(logger, exception=e)
@@ -109,7 +109,7 @@ def run_command(args):
109109
project_id=project_id,
110110
str_filename=str_filename,
111111
publish_mode=publish_mode,
112-
credentials=creds,
112+
credentials=datasource_credentials,
113113
)
114114
except Exception as exc:
115115
Errors.exit_with_error(logger, exception=exc)

tests/assets/mock_data.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,15 @@ def set_up_mock_server(mock_session):
9393
mock_server.any_item_type = getter
9494
mock_server.flows = getter
9595
mock_server.groups = getter
96-
mock_server.projects = getter
96+
# Ensure type name contains 'Projects' for filtering heuristics
97+
class ProjectsEndpoint:
98+
def __init__(self, ret):
99+
self._ret = ret
100+
101+
def get(self, req_option):
102+
return self._ret
103+
104+
mock_server.projects = ProjectsEndpoint(([create_fake_item()], fake_pagination))
97105
mock_server.sites = getter
98106
mock_server.users = getter
99107
mock_server.views = getter

tests/commands/test_publish_command.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
import tableauserverclient as TSC
44
from ..assets import mock_data
55
from unittest.mock import *
6+
from unittest import mock
67
from tabcmd.commands.datasources_and_workbooks.publish_command import PublishCommand
8+
from tabcmd.commands.datasources_and_workbooks import publish_command
79

810
from ..assets.mock_data import set_up_mock_args, set_up_mock_file, set_up_mock_path, set_up_mock_server
911

1012
mock_args = set_up_mock_args()
13+
mock_logger = mock.MagicMock()
1114

1215

1316
# mock the module as it is imported *when used*
@@ -83,39 +86,39 @@ def test_get_files_to_publish_folder(self, mock_path, mock_glob, mock_session):
8386
actual = PublishCommand.get_files_to_publish(mock_args, logging)
8487
assert actual == expected
8588

86-
def test_default_publish_mode(self, mock_session, mock_server):
89+
def test_default_publish_mode(self, mock_path, mock_glob, mock_session):
8790
mock_args.replace = False
8891
mock_args.append = False
8992
mock_args.overwrite = False
9093

9194
publish_mode = publish_command.PublishCommand.get_publish_mode(mock_args, mock_logger)
9295
self.assertEqual(publish_mode, TSC.Server.PublishMode.CreateNew)
9396

94-
def test_replace_publish_mode(self, mock_session, mock_server):
97+
def test_replace_publish_mode(self, mock_path, mock_glob, mock_session):
9598
mock_args.replace = True
9699
mock_args.append = False
97100
mock_args.overwrite = False
98101

99102
publish_mode = publish_command.PublishCommand.get_publish_mode(mock_args, mock_logger)
100103
self.assertEqual(publish_mode, TSC.Server.PublishMode.Replace)
101104

102-
def test_append_publish_mode(self, mock_session, mock_server):
105+
def test_append_publish_mode(self, mock_path, mock_glob, mock_session):
103106
mock_args.replace = False
104107
mock_args.append = True
105108
mock_args.overwrite = False
106109

107110
publish_mode = publish_command.PublishCommand.get_publish_mode(mock_args, mock_logger)
108111
self.assertEqual(publish_mode, TSC.Server.PublishMode.Append)
109112

110-
def test_overwrite_publish_mode(self, mock_session, mock_server):
113+
def test_overwrite_publish_mode(self, mock_path, mock_glob, mock_session):
111114
mock_args.replace = False
112115
mock_args.append = False
113116
mock_args.overwrite = True
114117

115118
publish_mode = publish_command.PublishCommand.get_publish_mode(mock_args, mock_logger)
116119
self.assertEqual(publish_mode, TSC.Server.PublishMode.Overwrite)
117120

118-
def test_invalid_combination_of_modes(self, mock_session, mock_server):
121+
def test_invalid_combination_of_modes(self, mock_path, mock_glob, mock_session):
119122
mock_args.replace = True
120123
mock_args.append = True
121124
mock_args.overwrite = False

0 commit comments

Comments
 (0)