Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 00d8a00

Browse files
gabor-borosAdam Grandquist
authored andcommitted
Simplify integration tests (rethinkdb#41)
* Extend logger to be able to write to stdout/stderr Description Adding functionality to the logger to be able to write to stdout/stderr. This feature was requested in https://github.com/RebirthDB/rebirthdb-python/pull/9/files/8328cc1a20e57615da7163cd50148e5042741bdc#diff-565263873ac3f2f37ce9d01ee9bd638a * Simplify integration tests Description Integration tests containes unused variables and other, not needed stuff, like `teardown_methods`. Note: Tear down methods are not needed in most of the cases, due to we are removing the DB itself at the end of every test. * Remove not necessary tear_down
1 parent 746a857 commit 00d8a00

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

tests/integration/test_cursor.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

33
from rebirthdb.errors import ReqlCursorEmpty
4-
from tests.helpers import IntegrationTestCaseBase, INTEGRATION_TEST_DB
4+
from tests.helpers import IntegrationTestCaseBase
55

66

77
@pytest.mark.integration
@@ -18,10 +18,6 @@ def setup_method(self):
1818
{'id': 5, 'name': 'Testing Cursor/Next 5'},
1919
]
2020

21-
def teardown_method(self):
22-
self.r.table_drop(self.table_name).run(self.conn)
23-
super(TestCursor, self).teardown_method()
24-
2521
def test_get_next_document(self):
2622
self.r.table(self.table_name).insert(self.documents).run(self.conn)
2723
documents = list()

tests/integration/test_database.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66

77
@pytest.mark.integration
8-
class TestCursorFor(IntegrationTestCaseBase):
8+
class TestDatabase(IntegrationTestCaseBase):
99
def setup_method(self):
10-
super(TestCursorFor, self).setup_method()
10+
super(TestDatabase, self).setup_method()
1111
self.test_db_name = 'test_database'
1212

1313
def test_db_create(self):

tests/integration/test_table.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ def setup_method(self):
1212

1313
def test_table_create(self):
1414
result = self.r.table_create(self.test_table_name).run(self.conn)
15-
self.r.table_drop(self.test_table_name).run(self.conn)
1615

1716
assert result['tables_created'] == 1
1817
assert len(result['config_changes']) == 1
@@ -28,7 +27,6 @@ def test_table_different_primary_key(self):
2827
expected_primary_key = 'bazinga'
2928

3029
result = self.r.table_create(self.test_table_name, primary_key=expected_primary_key).run(self.conn)
31-
self.r.table_drop(self.test_table_name).run(self.conn)
3230

3331
assert result['tables_created'] == 1
3432
assert len(result['config_changes']) == 1
@@ -38,7 +36,6 @@ def test_table_multiple_shards(self):
3836
expected_shards = 2
3937

4038
result = self.r.table_create(self.test_table_name, shards=expected_shards).run(self.conn)
41-
self.r.table_drop(self.test_table_name).run(self.conn)
4239

4340
assert result['tables_created'] == 1
4441
assert len(result['config_changes']) == 1
@@ -48,7 +45,6 @@ def test_table_create_with_replicas(self):
4845
expected_replicas = 1
4946

5047
result = self.r.table_create(self.test_table_name, replicas=expected_replicas).run(self.conn)
51-
self.r.table_drop(self.test_table_name).run(self.conn)
5248

5349
assert result['tables_created'] == 1
5450
assert len(result['config_changes']) == 1
@@ -67,8 +63,6 @@ def test_table_create_twice(self):
6763
with pytest.raises(ReqlRuntimeError):
6864
self.r.table_create(self.test_table_name).run(self.conn)
6965

70-
self.r.table_drop(self.test_table_name).run(self.conn)
71-
7266
def test_table_drop(self):
7367
self.r.table_create(self.test_table_name).run(self.conn)
7468

0 commit comments

Comments
 (0)