Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: ${{matrix.java}}
- name: Install connector-packager and dependencies
run: |
cd connector-packager
pip install -e .
pip install pytest
- name: Run Connector Packager unit tests with JDK ${{ matrix.java }}
run: |
cd connector-packager
python setup.py test
pytest tests/ -v
7 changes: 6 additions & 1 deletion connector-packager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ The [Pyright](https://marketplace.visualstudio.com/items?itemName=ms-pyright.pyr
### Test `connector-packager` Module

```
(.venv) PS connector-plugin-sdk\connector-packager> python setup.py test
(.venv) PS connector-plugin-sdk\connector-packager> pytest tests/
```

Or with verbose output:
```
(.venv) PS connector-plugin-sdk\connector-packager> pytest tests/ -v
```

### Run the `connector-packager` Module
Expand Down
2 changes: 1 addition & 1 deletion connector-packager/connector_packager/jar_jdk_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_min_support_version(file_list: List[ConnectorFile], cur_min_version_tabl
tdr_root = ET.parse(input_dir / connector_file.file_name).getroot()
attribute_list = tdr_root.find('.//connection-normalizer/required-attributes/attribute-list')

if not attribute_list:
if attribute_list is None:
if 2021.1 > float(min_version_tableau):
min_version_tableau = "2021.1"
reasons.append("Connector uses inferred connection resolver, which was added in the 2021.1 release")
Expand Down
8 changes: 4 additions & 4 deletions connector-packager/connector_packager/xsd_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,14 @@ def validate_file_specific_rules_tdr(file_to_test: ConnectorFile, path_to_file:

# The connection resolver appears after the dialog elements in the manifest's xml, so we know
# USES_TCD is accurate here
if not attribute_list and properties.uses_tcd:
if attribute_list is None and properties.uses_tcd:
xml_violations_buffer.append("Connectors using a .tcd file cannot use inferred connection resolver,"
"must manually populate required-attributes/attributes-list in "
+ str(path_to_file) + ".")
return False

# Check that all the connection-fields attributes are in the required attributes
if properties.connection_fields and attribute_list:
if properties.connection_fields and attribute_list is not None:
attributes = []
for attr in attribute_list.iter():
attributes.append(attr.text)
Expand All @@ -323,7 +323,7 @@ def validate_file_specific_rules_tdr(file_to_test: ConnectorFile, path_to_file:

properties_builder = root.find('.//connection-properties')

if not properties_builder and properties.is_jdbc:
if properties_builder is None and properties.is_jdbc:
xml_violations_buffer.append("Connectors using a 'jdbc' superclass must declare a <connection-properties> element in " +
str(path_to_file) + ".")
return False
Expand Down Expand Up @@ -373,7 +373,7 @@ def warn_file_specific_rules_tdr(path_to_file: Path):
root = xml_tree.getroot()
attribute_list = root.find('.//connection-normalizer/required-attributes/attribute-list')

if not attribute_list:
if attribute_list is None:
return

authentication_attr_exists = False
Expand Down
14 changes: 14 additions & 0 deletions connector-packager/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[pytest]
# Pytest configuration for connector-packager tests

# Test discovery
testpaths = tests
python_files = test_*.py
python_classes = Test*
python_functions = test_*

# Output options
addopts =
-v
--tb=short
--strict-markers
5 changes: 3 additions & 2 deletions connector-packager/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
packages=['connector_packager'],
license='MIT',
description='A Python module for packaging a Tableau connector.',
test_suite='tests',
python_requires='>3.7',
install_requires=['xmlschema', 'defusedxml', 'packaging'],
tests_require=['six'],
extras_require={
'dev': ['pytest>=7.0.0'],
},
include_package_data=True
)
2 changes: 1 addition & 1 deletion connector-packager/tests/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os

from collections import OrderedDict
from six import BytesIO
from io import BytesIO
from connector_packager.version import __version__


Expand Down
Loading