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

Fixes #3

Merged
merged 3 commits into from
Jan 17, 2015
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
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ noop:
.PHONY: noop

pytest:
coverage run --source pytest_cagoule -m pytest --cagoule-capture tests
coverage erase
coverage run -p --source pytest_cagoule -m pytest tests
coverage run -p --source pytest_cagoule -m pytest --cagoule-capture tests
coverage combine
coverage report --show-missing

flake8:
Expand Down
1 change: 1 addition & 0 deletions pytest_cagoule/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ def db_exists():

def get_connection():
connection = sqlite3.connect(DB_FILE)
connection.text_factory = bytes
return connection
2 changes: 1 addition & 1 deletion pytest_cagoule/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def write_results(self, nodeid, cov_data):
self.filename_values(cov_data)
)
connection.executemany(
"INSERT INTO coverage VALUES (?, ?, ?)",
"REPLACE INTO coverage VALUES (?, ?, ?)",
self.coverage_values(nodeid, cov_data)
)

Expand Down
2 changes: 0 additions & 2 deletions pytest_cagoule/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

def parse_spec(spec):
match = spec_re.match(spec)
if match is None:
return []
matches = match.groupdict()

filename = matches['filename']
Expand Down
16 changes: 16 additions & 0 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# coding: utf-8

from functools import partial
import sqlite3

import pytest

from pytest_cagoule import db
from pytest_cagoule import select

Expand All @@ -23,3 +27,15 @@ def test_foo():
get_connection = partial(get_test_connection, testdir)
monkeypatch.setattr(select, 'get_connection', get_connection)
assert select.get_node_ids([str(test_file)]) == ['test_basic.py::test_foo']


@pytest.mark.parametrize('val', ('foo', 'föö'))
def test_nonascii(val):
# make sure plugin captures nodeid ok
pass


@pytest.mark.parametrize('val', ('1', 1))
def test_same_as_strings(val):
# make sure plugin captures nodeid ok
pass
3 changes: 2 additions & 1 deletion tests/test_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def test_line_get_line_number_filter(
(
'/tmp/foo.py:3-5',
'filename = ? AND (line = ? OR line = ? OR line = ?)',
('/tmp/foo.py', 3, 4, 5)),
('/tmp/foo.py', 3, 4, 5),
),
)
)
def test_get_spec_filter(spec, expected_query, expected_params):
Expand Down