-
-
Notifications
You must be signed in to change notification settings - Fork 777
Use python imports to identify fixtures (part 1/6) #5699
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
Changes from all commits
be2a968
1f193e8
d9868a8
be902f5
8d6711d
3b9717e
a1c1daf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| from st2common.util.shell import run_command | ||
| from st2tests import config as test_config | ||
| from st2tests.fixturesloader import get_fixtures_packs_base_path | ||
| from st2tests.fixtures.packs.dummy_pack_1.fixture import PACK_PATH as DUMMY_PACK_1_PATH | ||
|
|
||
|
|
||
| BASE_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
|
|
@@ -43,7 +44,7 @@ def setUp(self): | |
| test_config.parse_args() | ||
|
|
||
| def test_register_from_pack_success(self): | ||
| pack_dir = os.path.join(get_fixtures_packs_base_path(), "dummy_pack_1") | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In most tests, we actually calculate the fixture path every time it's used. By adding the boilerplate inside each fixture, that calculation only needs to be done in one place (DRY). Instead, we just need to use the imported This line gets simplified to be: pack_dir = DUMMY_PACK_1_PATH |
||
| pack_dir = DUMMY_PACK_1_PATH | ||
| runner_dirs = os.path.join(get_fixtures_packs_base_path(), "runners") | ||
|
|
||
| opts = [ | ||
|
|
@@ -142,7 +143,7 @@ def test_register_from_packs_doesnt_throw_on_missing_pack_resource_folder(self): | |
| def test_register_all_and_register_setup_virtualenvs(self): | ||
| # Verify that --register-all works in combinations with --register-setup-virtualenvs | ||
| # Single pack | ||
| pack_dir = os.path.join(get_fixtures_packs_base_path(), "dummy_pack_1") | ||
| pack_dir = DUMMY_PACK_1_PATH | ||
| cmd = BASE_CMD_ARGS + [ | ||
| "--register-pack=%s" % (pack_dir), | ||
| "--register-all", | ||
|
|
@@ -157,7 +158,7 @@ def test_register_all_and_register_setup_virtualenvs(self): | |
|
|
||
| def test_register_setup_virtualenvs(self): | ||
| # Single pack | ||
| pack_dir = os.path.join(get_fixtures_packs_base_path(), "dummy_pack_1") | ||
| pack_dir = DUMMY_PACK_1_PATH | ||
|
|
||
| cmd = BASE_CMD_ARGS + [ | ||
| "--register-pack=%s" % (pack_dir), | ||
|
|
@@ -173,7 +174,7 @@ def test_register_setup_virtualenvs(self): | |
| def test_register_recreate_virtualenvs(self): | ||
| # 1. Register the pack and ensure it exists and doesn't rely on state from previous | ||
| # test methods | ||
| pack_dir = os.path.join(get_fixtures_packs_base_path(), "dummy_pack_1") | ||
| pack_dir = DUMMY_PACK_1_PATH | ||
|
|
||
| cmd = BASE_CMD_ARGS + [ | ||
| "--register-pack=%s" % (pack_dir), | ||
|
|
@@ -187,7 +188,7 @@ def test_register_recreate_virtualenvs(self): | |
| self.assertEqual(exit_code, 0) | ||
|
|
||
| # 2. Run it again with --register-recreate-virtualenvs flag | ||
| pack_dir = os.path.join(get_fixtures_packs_base_path(), "dummy_pack_1") | ||
| pack_dir = DUMMY_PACK_1_PATH | ||
|
|
||
| cmd = BASE_CMD_ARGS + [ | ||
| "--register-pack=%s" % (pack_dir), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is an import that would show pants that this test file uses the
dummy_pack_1fixture.