8000 Basic TWBX Support by t8y8 · Pull Request #43 · tableau/document-api-python · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@t8y8
Copy link
Contributor
@t8y8 t8y8 commented Jun 29, 2016
  • Support for read/write of connections in TWBX files
  • New TWBX tests
  • Moved test assets into a new folder and read from the gold copies for tests.
    -- Yay no more embedded xml!

Tests pass on OS X py27 and py35

Replaces #13

test/bvt.py Outdated
# TODO: Move the XML into external files and load them when needed

TABLEAU_93_WORKBOOK = '''<?xml version='1.0' encoding='utf-8' ?><workbook source-build='9.3.1 (9300.16.0510.0100)' source-platform='mac' version='9.3' xmlns:user='http://www.tableausoftware.com/xml/user'><datasources><datasource caption='xy (TestV1)' inline='true' name='sqlserver.17u3bqc16tjtxn14e2hxh19tyvpo' version='9.3'><connection authentication='sspi' class='sqlserver' dbname='TestV1' odbc-native-protocol='yes' one-time-sql='' server='mssql2012.test.tsi.lan' username=''></connection></datasource></datasources></workbook>''' # noqa
TABLEAU_93_TWB = 'test/assets/TABLEAU_93_TWB.twb'
Copy link
Contributor
@graysonarts graysonarts Jun 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use this pattern when accessing files in test cases, so it's always based on a specific path:

os.path.join(
  os.path.dirname(__file__),
  'test', 'asserts', filename
))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's less fragile.

It looks like it would be:

os.path.join( os.path.dirname(__file__), 'asserts', filename) )

No 'tests' directory, since bvt.py is already located in test.

Since os.path.dirname(__file__) is duplicated, how about:

`TEST_DIR = os.path.dirname(file)

TABLEAU_93_TWB = os.path.join(TEST_DIR, 'assets', 'TABLEAU_93_TWB.twb`
... etc

@graysonarts graysonarts merged commit 23e897a into tableau:development Jun 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0