Skip to content

Commit

Permalink
Merge pull request #3 from davidszotten/fixes
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
davidszotten committed Jan 17, 2015
2 parents d025cbe + 516ef91 commit 9d1c5ec
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 5 deletions.
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

0 comments on commit 9d1c5ec

Please sign in to comment.