Skip to content

Commit

Permalink
Migrate imp to importlib in path_test.py
Browse files Browse the repository at this point in the history
No longer works with python 3.12 or later.

PiperOrigin-RevId: 694480477
Change-Id: Ia662c8fb5511e9c551448730800240ab627463be
  • Loading branch information
meteorcloudy authored and copybara-github committed Nov 8, 2024
1 parent 89e5e4a commit 5b54c74
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tools/build_defs/pkg/path_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@
# limitations under the License.
"""Testing for helper functions."""

import imp
import importlib.machinery
import importlib.util
import unittest

pkg_bzl = imp.load_source(
'pkg_bzl',
'tools/build_defs/pkg/path.bzl')

loader = importlib.machinery.SourceFileLoader(
'pkg_bzl', 'tools/build_defs/pkg/path.bzl')
spec = importlib.util.spec_from_loader(loader.name, loader)
pkg_bzl = importlib.util.module_from_spec(spec)
loader.exec_module(pkg_bzl)


class File(object):
Expand Down

0 comments on commit 5b54c74

Please sign in to comment.