Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ct 1517/convert 060 persist docs #6409

Merged
merged 3 commits into from
Jan 9, 2023
Merged

Conversation

VersusFacit
Copy link
Contributor

resolves #6273

Description

Convert the test. There was a seed in here unused for whatever reason. I added it into the code env and bumped the assertion rhs in a line to complete the re-add.

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have signed the CLA
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have opened an issue to add/update docs, or docs changes are not required/relevant for this PR

@VersusFacit VersusFacit added the Skip Changelog Skips GHA to check for changelog file label Dec 8, 2022
@VersusFacit VersusFacit requested a review from a team as a code owner December 8, 2022 10:25
@VersusFacit VersusFacit self-assigned this Dec 8, 2022
@cla-bot cla-bot bot added the cla:yes label Dec 8, 2022
@mikealfare
Copy link
Contributor

If I understand the intent correctly, we're moving all of the files into fixtures. So instead of moving the .sql/.yml files from integration to functional, shouldn't we just delete them? From spot checking, it looks like we already put those in fixtures.py.


class BasePersistDocsTest:
@pytest.fixture(scope="class", autouse=True)
def setUp(self, project):
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is a fixture, is it? If you want this to run once per class, changing it to this should work:

@classmethod
def setup_class(cls):
    ...

If you need it for each method, then this should work:

def setup_method(self, method):
    ...

Copy link
Contributor Author

@VersusFacit VersusFacit Jan 4, 2023

Choose a reason for hiding this comment

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

We're using fixtures and these methods are for the "classical" way of doing tests. So, if I'm not mistaken, those aren't going to mesh well with our current framework.

Instead, we have an adhoc setup fixture we sometimes include. Granted, there's a few ways to do this depending on your use case. Sometimes, I define the class setup fixture at modular level and sometimes class scope it. Just depends.

For more, check out this SO post.

@@ -40,8 +70,12 @@ def _assert_has_table_comments(self, table_node):
table_comment, table_id_comment, table_name_comment
)

def _assert_has_view_comments(self, view_node, has_node_comments=True,
has_column_comments=True):
def _assert_has_view_comments(
Copy link
Contributor

Choose a reason for hiding this comment

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

This and _assert_has_table_comments() look like a good use case for parameterized tests (@pytest.mark.paraterize(...). I think that's what's effectively happening here, but it could be maintained more easily with the pytest built-ins.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I looked into this, and agree it's a neat built in. But I'm not sure it matches this use case. This flag appears to accomodate fixed values whereas we're passing in dynamically generated nodes. Am I missing something from your thinking here?

@VersusFacit
Copy link
Contributor Author

Yep, you're right on those old files. They were added with a sloppy git add. I like how the one time I use -a, the reason you shouldn't use -a happens.

Copy link
Contributor

@colin-rogers-dbt colin-rogers-dbt left a comment

Choose a reason for hiding this comment

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

LGTM

@VersusFacit VersusFacit merged commit ab3f8dc into main Jan 9, 2023
@VersusFacit VersusFacit deleted the CT-1517/convert_060_persist_docs branch January 9, 2023 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes Skip Changelog Skips GHA to check for changelog file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CT-1517] 060_persist_docs_tests
3 participants