Matteo Scandolo | d2044a4 | 2017-08-07 16:08:28 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Matteo Scandolo | 67654fa | 2017-06-09 09:33:17 -0700 | [diff] [blame] | 17 | import os |
| 18 | |
| 19 | # Constants |
| 20 | OUTPUT_DIR = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/out/") |
| 21 | |
| 22 | TMP_TARGET_PATH = os.path.join(OUTPUT_DIR, 'tmp.xtarget') |
| 23 | |
| 24 | # Store in this class the args to pass at the generator |
| 25 | class FakeArgs: |
| 26 | pass |
| 27 | |
| 28 | class XProtoTestHelpers: |
| 29 | |
| 30 | @staticmethod |
| 31 | def write_tmp_target(target): |
| 32 | tmp_file = open(TMP_TARGET_PATH, 'w') |
| 33 | tmp_file.write(target) |
| 34 | tmp_file.close() |
| 35 | return TMP_TARGET_PATH |
| 36 | |