|
8 | 8 | @pytest.mark.skipif( |
9 | 9 | os.getenv('VCAP_SERVICES') is None, reason='requires VCAP_SERVICES') |
10 | 10 | class TestSpeechToTextV1(TestCase): |
11 | | - def setUp(self): |
12 | | - self.speech_to_text = watson_developer_cloud.SpeechToTextV1( |
| 11 | + text_to_speech = None |
| 12 | + custom_models = None |
| 13 | + create_custom_model = None |
| 14 | + customization_id = None |
| 15 | + |
| 16 | + @classmethod |
| 17 | + def setup_class(cls): |
| 18 | + cls.speech_to_text = watson_developer_cloud.SpeechToTextV1( |
13 | 19 | username=os.getenv('YOUR SERVICE USERNAME'), |
14 | 20 | password=os.getenv('YOUR SERVICE PASSWORD')) |
15 | | - self.speech_to_text.set_default_headers({ |
| 21 | + cls.speech_to_text.set_default_headers({ |
16 | 22 | 'X-Watson-Learning-Opt-Out': |
17 | 23 | '1', |
18 | 24 | 'X-Watson-Test': |
19 | 25 | '1' |
20 | 26 | }) |
21 | | - self.custom_models = self.speech_to_text.list_language_models() |
22 | | - self.create_custom_model = self.speech_to_text.create_language_model( |
| 27 | + cls.custom_models = cls.speech_to_text.list_language_models() |
| 28 | + cls.create_custom_model = cls.speech_to_text.create_language_model( |
23 | 29 | name="integration_test_model", |
24 | 30 | base_model_name="en-US_BroadbandModel") |
25 | | - self.customization_id = self.create_custom_model['customization_id'] |
| 31 | + cls.customization_id = cls.create_custom_model['customization_id'] |
26 | 32 |
|
27 | | - def tearDown(self): |
28 | | - self.speech_to_text.delete_language_model( |
29 | | - customization_id=self.create_custom_model['customization_id']) |
| 33 | + @classmethod |
| 34 | + def teardown_class(cls): |
| 35 | + cls.speech_to_text.delete_language_model( |
| 36 | + customization_id=cls.create_custom_model['customization_id']) |
30 | 37 |
|
31 | 38 | def test_models(self): |
32 | 39 | output = self.speech_to_text.list_models() |
|
0 commit comments