Skip to content

bpo-26187: Tests sqlite3 trace callback no duplicate on shcema changing #461

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

Merged

Conversation

palaviv
Copy link
Contributor

@palaviv palaviv commented Mar 4, 2017

Test for issue 26187

@mention-bot
Copy link

@palaviv, thanks for your PR! By analyzing the history of the files in this pull request, we identified @Yhg1s, @ghaering, @berkerpeksag, @mdickinson and @serhiy-storchaka to be potential reviewers.

Copy link
Member

@berkerpeksag berkerpeksag left a comment

Choose a reason for hiding this comment

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

Please also add a note to Misc/NEWS and mention the v2 API change.

@unittest.skipIf(sqlite.sqlite_version_info < (3, 3, 9), "sqlite3_prepare_v2 is not available")
def CheckTraceCallbackContent(self):
"""
Test that the statement are correct. Fix for bpo-26187
Copy link
Member

Choose a reason for hiding this comment

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

Docstring is not needed here. Just add a comment with a reference to bpo-26187.

@@ -23,6 +23,7 @@

import unittest
import sqlite3 as sqlite
from tempfile import NamedTemporaryFile
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: I'd prefer import tempfile.

def trace(statement):
traced_statements.append(statement)

queries = ["create table foo(x)",
Copy link
Member

Choose a reason for hiding this comment

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

traced_statements, trace and queries can go outside of the with statements.

"""
Test that the statement are correct. Fix for bpo-26187
"""
with NamedTemporaryFile(suffix='.sqlite') as db_path:
Copy link
Member

Choose a reason for hiding this comment

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

NamedTemporaryFile is known to be problematic on Windows. Did you check that it cleanups the temp file?

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 will look what they do in other test's and copy it.

con2.execute("create table bar(x)")
cur.execute(queries[1])
self.assertEqual(traced_statements, queries)

Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: Please delete the extra new line.

@unittest.skipIf(sqlite.sqlite_version_info < (3, 3, 9), "sqlite3_prepare_v2 is not available")
def CheckTraceCallbackContent(self):
"""
bpo-26187
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer a plain Python comment instead of a docstring:

# set_trace_callback() shouldn't produce duplicate content (bpo-26187)

Misc/NEWS Outdated
@@ -278,6 +278,10 @@ Extension Modules
Library
-------

- bpo-26187: Test that sqlite trace callback is not called multiple
Copy link
Member

Choose a reason for hiding this comment

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

sqlite -> sqlite3?

Misc/NEWS Outdated
@@ -278,6 +278,10 @@ Extension Modules
Library
-------

- bpo-26187: Test that sqlite trace callback is not called multiple
times when schema is changing. Fixed by bpo-9303
Copy link
Member

Choose a reason for hiding this comment

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

Add two spaces at the end of a sentence.

Misc/NEWS Outdated
@@ -278,6 +278,10 @@ Extension Modules
Library
-------

- bpo-26187: Test that sqlite trace callback is not called multiple
times when schema is changing. Fixed by bpo-9303
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we can say something like "Indirectly fixed by switching to use sqlite3_prepare_v2() in bpo-9303."?

Misc/NEWS Outdated
@@ -302,6 +306,7 @@ Library
check identity before checking equality when do comparisons.

- bpo-28682: Added support for bytes paths in os.fwalk().
>>>>>>> upstream/master
Copy link
Member

Choose a reason for hiding this comment

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

This looks like a merge glitch :)

@berkerpeksag
Copy link
Member

Looks good, thanks! I just fixed the merge conflict and will merge it when Travis is done.

@berkerpeksag berkerpeksag merged commit 0e6cb2e into python:master Apr 9, 2017
jaraco pushed a commit that referenced this pull request Dec 2, 2022
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.12.0 to 2.12.1.
- [Release notes](https://github.com/pytest-dev/pytest-cov/releases)
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](pytest-dev/pytest-cov@v2.12.0...v2.12.1)

---
updated-dependencies:
- dependency-name: pytest-cov
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mariatta Wijaya <Mariatta@users.noreply.github.com>
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.

4 participants