-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add session setting support for specs (#381)
This adds support for session settings for specs. The session settings will be applied to each connection before executing the spec. Co-authored-by: Mathias Fussenegger <[email protected]>
- Loading branch information
1 parent
9d07688
commit d910d77
Showing
9 changed files
with
111 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
from unittest import TestCase | ||
from doctest import DocTestSuite | ||
|
||
from cr8.bench_spec import load_spec | ||
|
||
from cr8 import engine | ||
|
||
|
||
class SpecTest(TestCase): | ||
|
||
def test_session_settings_from_spec(self): | ||
spec = self.get_spec('sample.py') | ||
self.assertEqual(spec.session_settings, {'application_name': 'my_app', 'timezone': 'UTC'}) | ||
|
||
def test_session_settings_from_toml(self): | ||
spec = self.get_spec('sample.toml') | ||
self.assertEqual(spec.session_settings, {'application_name': 'my_app', 'timezone': 'UTC'}) | ||
|
||
def test_session_settings_from_json(self): | ||
spec = self.get_spec('count_countries.json') | ||
self.assertEqual(spec.session_settings, {'application_name': 'my_app', 'timezone': 'UTC'}) | ||
|
||
def get_spec(self, name): | ||
return load_spec(os.path.abspath(os.path.join(os.path.dirname(__file__), '../specs/', name))) | ||
|
||
|
||
def load_tests(loader, tests, ignore): | ||
tests.addTests(DocTestSuite(engine)) | ||
return tests |