Skip to content

[LIVY-848] Adjusting Livy test cases to be compatible with Python3#316

Open
jameschen1519 wants to merge 2 commits intoapache:masterfrom
jameschen1519:LIVY-848
Open

[LIVY-848] Adjusting Livy test cases to be compatible with Python3#316
jameschen1519 wants to merge 2 commits intoapache:masterfrom
jameschen1519:LIVY-848

Conversation

@jameschen1519
Copy link
Copy Markdown

What changes were proposed in this pull request?

At the moment, the Livy test cases error out when run with Python3 instead of Python2. Many of these errors are simple errors revolving around parentheses, or errors involved imports with changed names, and the changes are mostly backwards compatible (with mild tinkering required in the case of imports with adjusted locations).

https://issues.apache.org/jira/browse/LIVY-848

How was this patch tested?

This patch was tested with a slightly different build of Livy. While the current version of Livy was not explicitly tested, the fundamental reasoning behind each change in this PR should still be applicable and benefit the health of the repository.

@jameschen1519
Copy link
Copy Markdown
Author

Not too familiar with how the packages around here work, but it looks like the TravisCI log has some sort of versioning issue with setuptools_scm-6.0.1:

`[INFO] ------------------< org.apache.livy:livy-python-api >-------------------
[INFO] Building livy-python-api 0.8.0-incubating-SNAPSHOT [24/25]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.2:prepare-agent (default) @ livy-python-api ---
[INFO] Skipping JaCoCo execution because property jacoco.skip is set.
[INFO] argLine set to empty
[INFO]
[INFO] --- maven-remote-resources-plugin:1.5:process (process-resource-bundles) @ livy-python-api ---
[INFO]
[INFO] --- scala-maven-plugin:4.2.0:compile (scala-compile-first) @ livy-python-api ---
[INFO] compile in 0.0 s
[INFO] No sources to compile
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:exec (python-api install) @ livy-python-api ---
Traceback (most recent call last):
File "setup.py", line 58, in
tests_require=['pytest']
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
/tmp/easy_install-mAOVjT/pytest-runner-5.3.0/temp/easy_install-o_FWda/setuptools_scm-6.0.1/src
<pkg_resources.WorkingSet object at 0x7f14c38b2510>
_setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 318, in init
self.fetch_build_eggs(attrs['setup_requires'])
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 375, in fetch_build_eggs
replace_conflicting=True,
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 851, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 1123, in best_match
return self.obtain(req, installer)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 1135, in obtain
return installer(requirement)
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 443, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 673, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 699, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 880, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1119, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1105, in run_setup
run_setup(setup_script, args)
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 258, in run_setup
raise
File "/usr/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/usr/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 169, in save_modules
saved_exc.resume()
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 144, in resume
six.reraise(type, exc, self._tb)
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 157, in save_modules
yield saved
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 255, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 285, in run
return func()
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 253, in runner
_execfile(setup_script, ns)
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 47, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-mAOVjT/pytest-runner-5.3.0/setup.py", line 21, in

File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 318, in init
self.fetch_build_eggs(attrs['setup_requires'])
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 375, in fetch_build_eggs
replace_conflicting=True,
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 851, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 1123, in best_match
return self.obtain(req, installer)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/init.py", line 1135, in obtain
return installer(requirement)
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 443, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 673, in easy_install
return self.install_item(spec, dist.location, tmpdir, deps)
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 699, in install_item
dists = self.install_eggs(spec, download, tmpdir)
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 880, in install_eggs
return self.build_and_install(setup_script, setup_base)
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1119, in build_and_install
self.run_setup(setup_script, setup_base, args)
File "/usr/local/lib/python2.7/dist-packages/setuptools/command/easy_install.py", line 1105, in run_setup
run_setup(setup_script, args)
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 258, in run_setup
raise
File "/usr/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/usr/lib/python2.7/contextlib.py", line 35, in exit
self.gen.throw(type, value, traceback)
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 169, in save_modules
saved_exc.resume()
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 144, in resume
six.reraise(type, exc, self._tb)
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 157, in save_modules
yield saved
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 198, in setup_context
yield
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 255, in run_setup
DirectorySandbox(setup_dir).run(runner)
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 285, in run
return func()
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 253, in runner
_execfile(setup_script, ns)
File "/usr/local/lib/python2.7/dist-packages/setuptools/sandbox.py", line 47, in _execfile
exec(code, globals, locals)
File "/tmp/easy_install-mAOVjT/pytest-runner-5.3.0/temp/easy_install-o_FWda/setuptools_scm-6.0.1/setup.py", line 52, in
description=DESCRIPTION,
File "/tmp/easy_install-mAOVjT/pytest-runner-5.3.0/temp/easy_install-o_FWda/setuptools_scm-6.0.1/setup.py", line 29, in scm_config

File "/tmp/easy_install-mAOVjT/pytest-runner-5.3.0/temp/easy_install-o_FWda/setuptools_scm-6.0.1/src/setuptools_scm/init.py", line 8, in
File "/tmp/easy_install-mAOVjT/pytest-runner-5.3.0/temp/easy_install-o_FWda/setuptools_scm-6.0.1/src/setuptools_scm/config.py", line 6, in
File "/tmp/easy_install-mAOVjT/pytest-runner-5.3.0/temp/easy_install-o_FWda/setuptools_scm-6.0.1/src/setuptools_scm/utils.py", line 41
print(*k)
^
SyntaxError: invalid syntax`

This is irrelevant to this change, and appears to be caused by "print(*k)" not being valid syntax in Python 2.7 (since unpacking isn't supported in this way).

Ideally, we would be downgrading the version of setuptools_scm to something before the version at pypa/setuptools-scm@22a44c1, or upgrading everything to Python 3.

@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has had no activity for at least 3 months. If you are still working on this change or plan to move it forward, please leave a comment or push a new commit so we know to keep it open. Otherwise, this PR will be closed automatically in about one month. Thank you for your contribution to Apache Livy!

@github-actions github-actions bot added the stale label Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant