Example #1
0
#  You may obtain a copy of the License at
#   http://www.apache.org/licenses/LICENSE-2.0
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
import sys
import traceback

from click.testing import CliRunner

from sodasql.cli.cli import main

if __name__ == "__main__":

    run_result = None
    try:
        runner = CliRunner()
        runner.file = sys.stdout
        run_result = runner.invoke(main, [
            'create', '-d sodasql', '-u', 'sodasql', '~/soda_sql_tutorial3',
            'postgres'
        ])
    except Exception as e:
        traceback.print_exc()
    if run_result:
        print(f'\nConsole:')
        print(run_result.output)
    print(f'\nExit code {run_result.exit_code}')