add deprecation warning to dsl-compile (#7628)
This commit is contained in:
parent
ec0081372a
commit
6cecfd948e
|
@ -17,6 +17,7 @@ import itertools
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
|
@ -117,7 +118,7 @@ class TestCliAutocomplete(parameterized.TestCase):
|
||||||
def test_show_autocomplete(self, shell):
|
def test_show_autocomplete(self, shell):
|
||||||
result = self.invoke(args=['--show-completion', shell])
|
result = self.invoke(args=['--show-completion', shell])
|
||||||
expected = cli._create_completion(shell)
|
expected = cli._create_completion(shell)
|
||||||
self.assertTrue(expected in result.output)
|
self.assertIn(expected, result.output)
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
|
|
||||||
@parameterized.parameters(['bash', 'zsh', 'fish'])
|
@parameterized.parameters(['bash', 'zsh', 'fish'])
|
||||||
|
@ -256,6 +257,11 @@ class TestDslCompile(parameterized.TestCase):
|
||||||
result = self.invoke_deprecated(['--help'])
|
result = self.invoke_deprecated(['--help'])
|
||||||
self.assertEqual(result.exit_code, 0)
|
self.assertEqual(result.exit_code, 0)
|
||||||
|
|
||||||
|
def test_deprecation_warning(self):
|
||||||
|
res = subprocess.run(['dsl-compile', '--help'], capture_output=True)
|
||||||
|
self.assertIn('Deprecated. Please use `kfp dsl compile` instead.)',
|
||||||
|
res.stdout.decode('utf-8'))
|
||||||
|
|
||||||
|
|
||||||
info_dict = cli.cli.to_info_dict(ctx=click.Context(cli.cli))
|
info_dict = cli.cli.to_info_dict(ctx=click.Context(cli.cli))
|
||||||
commands_dict = {
|
commands_dict = {
|
||||||
|
|
|
@ -147,6 +147,7 @@ def dsl_compile(
|
||||||
def main():
|
def main():
|
||||||
logging.basicConfig(format='%(message)s', level=logging.INFO)
|
logging.basicConfig(format='%(message)s', level=logging.INFO)
|
||||||
try:
|
try:
|
||||||
|
dsl_compile.help = '(Deprecated. Please use `kfp dsl compile` instead.)\n\n' + dsl_compile.help
|
||||||
dsl_compile(obj={}, auto_envvar_prefix='KFP')
|
dsl_compile(obj={}, auto_envvar_prefix='KFP')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
click.echo(str(e), err=True)
|
click.echo(str(e), err=True)
|
||||||
|
|
Loading…
Reference in New Issue