Update Python Support for Python 3.10.5 with Integration Test Fixes (#101)

* Updated test packages due to
legacy package errors.

* Support for special character
connection string pwds

* Updated test_no_output composition

* Fix test script.

* test comments

* update version number

* skip long running test.

* Update skipped tests to not have long running python package install test.

Co-authored-by: Sean Leonard <seleonar@microsoft.com>
This commit is contained in:
Sean Leonard 2022-08-15 17:05:37 -07:00 коммит произвёл GitHub
Родитель 1273edd4d5
Коммит 1f36ef30f9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 26 добавлений и 15 удалений

Просмотреть файл

@ -6,7 +6,7 @@ from setuptools import setup
setup(
name='sqlmlutils',
packages=['sqlmlutils', 'sqlmlutils/packagemanagement'],
version='1.1.0',
version='1.2.0',
url='https://github.com/Microsoft/sqlmlutils/Python',
license='MIT License',
description='A client side package for working with SQL Server',

Просмотреть файл

@ -56,7 +56,7 @@ class ConnectionInfo:
else "{server},{port}".format(server=self._server, port=self._port)
auth = "Trusted_Connection=Yes" if self._uid == "" \
else "uid={uid};pwd={pwd}".format(uid=self._uid, pwd=self._pwd)
else "uid={uid};pwd={{{pwd}}}".format(uid=self._uid, pwd=self._pwd)
return "Driver={driver};Server={server};Database={database};{auth};".format(
driver = self._driver,

Просмотреть файл

@ -75,7 +75,7 @@ def _remove_all_new_packages(manager):
# Download the package zips we will use for these tests
#
packages = ["astor==0.8.1", "html5lib==1.0.1", "termcolor==1.1.0"]
packages = ["astor==0.8.1", "html5lib==1.1", "termcolor==1.1.0"]
for package in packages:
pipdownloader = PipDownloader(connection, path_to_packages, package, language_name="Python")
@ -90,9 +90,10 @@ def test_install_basic_zip_package():
_create(module_name=module_name, package_file=package, class_to_check="ClassA")
@pytest.mark.skip(reason="Very long running test. Skip for CI.")
def test_install_whl_files():
"""Test some basic wheel files"""
packages = ["html5lib-1.0.1-py2.py3-none-any.whl",
packages = ["html5lib-1.1-py2.py3-none-any.whl",
"astor-0.8.1-py2.py3-none-any.whl"]
module_names = ["html5lib", "astor"]
classes_to_check = ["parse", "code_gen"]
@ -117,6 +118,7 @@ def test_install_targz_files():
full_package = os.path.join(path_to_packages, package)
_create(module_name=module, package_file=full_package, class_to_check=class_to_check)
@pytest.mark.skip(reason="Very long running test. Skip for CI.")
def test_install_bad_package_badzipfile():
"""Test a zip that is not a package, then make sure it is not in the external_libraries table"""
_remove_all_new_packages(pkgmanager)
@ -167,7 +169,6 @@ def test_package_already_exists_on_sql_table():
pkgmanager.uninstall("testpackageA")
def test_scope():
"""Test installing in a private scope with a db_owner (not dbo) user"""
_remove_all_new_packages(pkgmanager)
@ -178,12 +179,13 @@ def test_scope():
import testpackageA
return testpackageA.__file__
# The airline_user_connection is NOT dbo, so it has access to both Private and Public scopes
# The airline_user_connection is database user "airlineuser" and is NOT dbo,
# so it has access to both Private and Public scopes
#
revopkgmanager = SQLPackageManager(airline_user_connection)
revoexecutor = SQLPythonExecutor(airline_user_connection)
# Install a package into the private scope
# Install a package into the private scope using database user "airlineuser"
#
revopkgmanager.install(package, scope=Scope.private_scope())
private_location = revoexecutor.execute_function_in_sql(get_location)
@ -192,6 +194,8 @@ def test_scope():
pyexecutor.execute_function_in_sql(check_package, package_name=pkg_name, exists=False)
# Uninstall packages installed into database user "airlineuser" private directory.
#
revopkgmanager.uninstall(pkg_name, scope=Scope.private_scope())
# Try the same installation in public scope
@ -204,7 +208,10 @@ def test_scope():
revopkgmanager.uninstall(pkg_name, scope=Scope.public_scope())
# Make sure the package was removed properly
# Make sure the package was removed properly from private scope
#
revoexecutor.execute_function_in_sql(check_package, package_name=pkg_name, exists=False)
# Make sure the package was removed properly from public scope
#
pyexecutor.execute_function_in_sql(check_package, package_name=pkg_name, exists=False)

Просмотреть файл

@ -5,3 +5,7 @@ def foo(t1, t2, t3):
param_str = foo(t1,t2,t3)
print("Testing output!")
# The double single quotes below are need for SPEES execution test.
data = {''Numbers'':[1, 2, 3, 4]}
OutputDataSet = DataFrame(data)

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичные данные
Python/tests/scripts/test_packages/termcolor-1.1.0.tar.gz Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -29,11 +29,9 @@ set_option("display.max_columns", None)
def test_no_output():
"""Test a function without output param/dataset"""
def my_func():
print("blah blah blah")
# Test single quotes as well
#
print('Hello')
x = 1
y = 2
z = x + y
name = "test_no_output"
sqlpy.drop_sproc(name)
@ -43,7 +41,9 @@ def test_no_output():
x, outparams = sqlpy.execute_sproc(name)
assert type(x) == DataFrame
assert x.empty
# Do not check x.empty, as x will always contain DataFrame representing OutputDataSet
# so we only check that outparams are empty as expected
assert not outparams
sqlpy.drop_sproc(name)
@ -440,7 +440,7 @@ def test_script_out_param():
assert sqlpy.check_sproc(name)
res, outparams = sqlpy.execute_sproc(name, output_params = output_params, t1="Hello", t2 = 123, t3 = "select top 10 * from airline5000")
assert "Hello123" in outparams["param_str"]
assert "Hello123" == outparams["param_str"]
sqlpy.drop_sproc(name)
assert not sqlpy.check_sproc(name)