Skip to content

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

Merged
berkerpeksag merged 8 commits into
python:masterfrom
palaviv:test-sqlite-trace-duplicate-lines
Apr 9, 2017
Merged

bpo-26187: Tests sqlite3 trace callback no duplicate on shcema changing#461
berkerpeksag merged 8 commits into
python:masterfrom
palaviv:test-sqlite-trace-duplicate-lines

Conversation

@palaviv
Copy link
Copy Markdown
Contributor

@palaviv palaviv commented Mar 4, 2017

Test for issue 26187

@mention-bot
Copy link
Copy Markdown

@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
Copy Markdown
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.

Comment thread Lib/sqlite3/test/hooks.py Outdated
@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
Copy Markdown
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.

Comment thread Lib/sqlite3/test/hooks.py Outdated

import unittest
import sqlite3 as sqlite
from tempfile import NamedTemporaryFile
Copy link
Copy Markdown
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.

Comment thread Lib/sqlite3/test/hooks.py Outdated
def trace(statement):
traced_statements.append(statement)

queries = ["create table foo(x)",
Copy link
Copy Markdown
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.

Comment thread Lib/sqlite3/test/hooks.py Outdated
"""
Test that the statement are correct. Fix for bpo-26187
"""
with NamedTemporaryFile(suffix='.sqlite') as db_path:
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread Lib/sqlite3/test/hooks.py
con2.execute("create table bar(x)")
cur.execute(queries[1])
self.assertEqual(traced_statements, queries)

Copy link
Copy Markdown
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.

Comment thread Lib/sqlite3/test/hooks.py Outdated
@unittest.skipIf(sqlite.sqlite_version_info < (3, 3, 9), "sqlite3_prepare_v2 is not available")
def CheckTraceCallbackContent(self):
"""
bpo-26187
Copy link
Copy Markdown
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)

Comment thread Misc/NEWS Outdated
Library
-------

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

Choose a reason for hiding this comment

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

sqlite -> sqlite3?

Comment thread Misc/NEWS Outdated
-------

- bpo-26187: Test that sqlite trace callback is not called multiple
times when schema is changing. Fixed by bpo-9303
Copy link
Copy Markdown
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.

Comment thread Misc/NEWS Outdated
-------

- bpo-26187: Test that sqlite trace callback is not called multiple
times when schema is changing. Fixed by bpo-9303
Copy link
Copy Markdown
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."?

Comment thread Misc/NEWS Outdated
check identity before checking equality when do comparisons.

- bpo-28682: Added support for bytes paths in os.fwalk().
>>>>>>> upstream/master
Copy link
Copy Markdown
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
Copy Markdown
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