From 8ffcff0824fd18dc30e21ad9596c6e48d1bc2ee6 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Wed, 11 Nov 2020 15:55:25 +0100 Subject: [PATCH 1/3] Python: Add example of top-level module shadowing stdlib Although this test is added under the `wrong` folder, the current results from this CodeQL test is actually correct (compared with the Python interpreter). However, they don't match what the extractor does when invoked with `codeql database create`. Since I deemed it "more than an easy fix" to change the extractor behavior for `codeql database create` to match the real python behavior, and it turned out to be quite a challenge to change the extractor behavior for all tests, I'm just going to make THIS ONE test-case behave like the extractor will with `codeql database create`... This is a first commit, to show how the extractor works with qltest by default. Inspired by the debugging in https://github.com/github/codeql/issues/4640 --- .../LocalModuleWithRef.expected | 3 +++ .../conflict-stdlib/LocalModuleWithRef.ql | 13 +++++++++++++ .../conflict-stdlib/LocalModules.expected | 5 +++++ .../conflict-stdlib/LocalModules.ql | 5 +++++ .../ModuleWithLocalRef.expected | 3 +++ .../conflict-stdlib/ModuleWithLocalRef.ql | 19 +++++++++++++++++++ .../module-imports/conflict-stdlib/README.md | 8 ++++++++ .../module-imports/conflict-stdlib/cmd.py | 2 ++ .../module-imports/conflict-stdlib/options | 1 + .../conflict-stdlib/test_fail.py | 3 +++ .../module-imports/conflict-stdlib/test_ok.py | 2 ++ .../conflict-stdlib/unique_name.py | 1 + .../conflict-stdlib/unique_name_use.py | 2 ++ 13 files changed, 67 insertions(+) create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.expected create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.ql create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.expected create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.ql create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.ql create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/README.md create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/cmd.py create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/options create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/test_fail.py create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/test_ok.py create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/unique_name.py create mode 100644 python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/unique_name_use.py diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.expected b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.expected new file mode 100644 index 000000000000..d5c1329b6573 --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.expected @@ -0,0 +1,3 @@ +| Local module | cmd.py:0:0:0:0 | Module cmd | referenced in external file called | pdb.py | +| Local module | cmd.py:0:0:0:0 | Module cmd | referenced in local file called | test_ok.py | +| Local module | unique_name.py:0:0:0:0 | Module unique_name | referenced in local file called | unique_name_use.py | diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.ql b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.ql new file mode 100644 index 000000000000..5bdb99415b2a --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.ql @@ -0,0 +1,13 @@ +import python + +from ModuleValue mv, ControlFlowNode ref, string local_external +where + ref = mv.getAReference() and + exists(mv.getScope().getFile().getRelativePath()) and + ( + if exists(ref.getLocation().getFile().getRelativePath()) + then local_external = "local" + else local_external = "external" + ) +select "Local module", mv, "referenced in " + local_external + " file called", + ref.getLocation().getFile().getShortName() diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.expected b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.expected new file mode 100644 index 000000000000..ffed6f7edc79 --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.expected @@ -0,0 +1,5 @@ +| cmd.py:0:0:0:0 | Module cmd | +| test_fail.py:0:0:0:0 | Module test_fail | +| test_ok.py:0:0:0:0 | Module test_ok | +| unique_name.py:0:0:0:0 | Module unique_name | +| unique_name_use.py:0:0:0:0 | Module unique_name_use | diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.ql b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.ql new file mode 100644 index 000000000000..faacf90522d8 --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.ql @@ -0,0 +1,5 @@ +import python + +from Module m +where exists(m.getFile().getRelativePath()) +select m diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected new file mode 100644 index 000000000000..c2c230b25f9d --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected @@ -0,0 +1,3 @@ +| Module 'cmd' (local, not in stdlib, not missing) referenced in local file | test_ok.py:1 | +| Module 'pdb' (external, in stdlib, not missing) referenced in local file | test_fail.py:3 | +| Module 'unique_name' (local, not in stdlib, not missing) referenced in local file | unique_name_use.py:1 | diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.ql b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.ql new file mode 100644 index 000000000000..030211ba0bf7 --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.ql @@ -0,0 +1,19 @@ +import python + +from ModuleValue mv, ControlFlowNode ref, string in_stdlib, string local_external, string is_missing +where + ref = mv.getAReference() and + exists(ref.getLocation().getFile().getRelativePath()) and + ( + if mv.getScope().getFile().inStdlib() + then in_stdlib = "in stdlib" + else in_stdlib = "not in stdlib" + ) and + ( + if exists(mv.getScope().getFile().getRelativePath()) + then local_external = "local" + else local_external = "external" + ) and + (if mv.isAbsent() then is_missing = "missing" else is_missing = "not missing") +select "Module '" + mv.getName() + "' (" + local_external + ", " + in_stdlib + ", " + is_missing + + ") referenced in local file", ref.getLocation().toString() diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/README.md b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/README.md new file mode 100644 index 000000000000..cd607bc0cf78 --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/README.md @@ -0,0 +1,8 @@ +This test shows how we handle modules the shadow a module in the standard library. + +We manually replicate the behavior of `codeql database create --source-root `, which will use `-R `. By default, the way qltest invokes the extractor will cause different behavior. Therefore, we also need to move our code outside of the top-level folder, and it lives in `code/`. + +Because we have a `cmd.py` file, whenever the python interpreter sees `import cmd`, that is the file that will be used! -- + +* `python test_ok.py` works as intended, and prints `Foo` +* `python test_fail.py` raises an exception, since it imports `pdb.py` from the standard library, which (at least in Python 3.8) tries to import `cmd.py` from the standard library, but instead is served our `cmd.py` module. Therefore it fails with `AttributeError: module 'cmd' has no attribute 'Cmd'` diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/cmd.py b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/cmd.py new file mode 100644 index 000000000000..58bbb12f69c1 --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/cmd.py @@ -0,0 +1,2 @@ +foo = "Foo" +print("my own cmd imported") diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/options b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/options new file mode 100644 index 000000000000..b91afde07678 --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/options @@ -0,0 +1 @@ +semmle-extractor-options: --max-import-depth=2 diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/test_fail.py b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/test_fail.py new file mode 100644 index 000000000000..f9621b260937 --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/test_fail.py @@ -0,0 +1,3 @@ +# we import `pdb` which import the `cmd` module from the standard library +# and allows us to set --max-import-depth=2, to make the test run fast +import pdb diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/test_ok.py b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/test_ok.py new file mode 100644 index 000000000000..6dcf8eb614eb --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/test_ok.py @@ -0,0 +1,2 @@ +from cmd import foo +print(foo) diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/unique_name.py b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/unique_name.py new file mode 100644 index 000000000000..191d0d6e4191 --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/unique_name.py @@ -0,0 +1 @@ +foo = "Foo" diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/unique_name_use.py b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/unique_name_use.py new file mode 100644 index 000000000000..79d2ca3c3501 --- /dev/null +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/unique_name_use.py @@ -0,0 +1,2 @@ +from unique_name import foo +print(foo) From 7e407d43d229de6a3cba3bcd94d442d1e0ba8b2c Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Thu, 19 Nov 2020 13:31:57 +0100 Subject: [PATCH 2/3] Python: Change (single) test to match `codeql database create` --- .../conflict-stdlib/LocalModuleWithRef.expected | 3 --- .../conflict-stdlib/LocalModules.expected | 10 +++++----- .../conflict-stdlib/ModuleWithLocalRef.expected | 6 +++--- .../wrong/module-imports/conflict-stdlib/README.md | 6 ++++-- .../{ => code-invalid-package-name}/cmd.py | 0 .../{ => code-invalid-package-name}/test_fail.py | 0 .../{ => code-invalid-package-name}/test_ok.py | 0 .../{ => code-invalid-package-name}/unique_name.py | 0 .../{ => code-invalid-package-name}/unique_name_use.py | 0 .../wrong/module-imports/conflict-stdlib/options | 2 +- 10 files changed, 13 insertions(+), 14 deletions(-) rename python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/{ => code-invalid-package-name}/cmd.py (100%) rename python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/{ => code-invalid-package-name}/test_fail.py (100%) rename python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/{ => code-invalid-package-name}/test_ok.py (100%) rename python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/{ => code-invalid-package-name}/unique_name.py (100%) rename python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/{ => code-invalid-package-name}/unique_name_use.py (100%) diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.expected b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.expected index d5c1329b6573..e69de29bb2d1 100644 --- a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.expected +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModuleWithRef.expected @@ -1,3 +0,0 @@ -| Local module | cmd.py:0:0:0:0 | Module cmd | referenced in external file called | pdb.py | -| Local module | cmd.py:0:0:0:0 | Module cmd | referenced in local file called | test_ok.py | -| Local module | unique_name.py:0:0:0:0 | Module unique_name | referenced in local file called | unique_name_use.py | diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.expected b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.expected index ffed6f7edc79..7d18240655fa 100644 --- a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.expected +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/LocalModules.expected @@ -1,5 +1,5 @@ -| cmd.py:0:0:0:0 | Module cmd | -| test_fail.py:0:0:0:0 | Module test_fail | -| test_ok.py:0:0:0:0 | Module test_ok | -| unique_name.py:0:0:0:0 | Module unique_name | -| unique_name_use.py:0:0:0:0 | Module unique_name_use | +| code-invalid-package-name/cmd.py:0:0:0:0 | Script cmd.py | +| code-invalid-package-name/test_fail.py:0:0:0:0 | Script test_fail.py | +| code-invalid-package-name/test_ok.py:0:0:0:0 | Script test_ok.py | +| code-invalid-package-name/unique_name.py:0:0:0:0 | Script unique_name.py | +| code-invalid-package-name/unique_name_use.py:0:0:0:0 | Script unique_name_use.py | diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected index c2c230b25f9d..2c66cfdbc993 100644 --- a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/ModuleWithLocalRef.expected @@ -1,3 +1,3 @@ -| Module 'cmd' (local, not in stdlib, not missing) referenced in local file | test_ok.py:1 | -| Module 'pdb' (external, in stdlib, not missing) referenced in local file | test_fail.py:3 | -| Module 'unique_name' (local, not in stdlib, not missing) referenced in local file | unique_name_use.py:1 | +| Module 'cmd' (external, in stdlib, not missing) referenced in local file | code-invalid-package-name/test_ok.py:1 | +| Module 'pdb' (external, in stdlib, not missing) referenced in local file | code-invalid-package-name/test_fail.py:3 | +| Module 'unique_name' (external, not in stdlib, missing) referenced in local file | code-invalid-package-name/unique_name_use.py:1 | diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/README.md b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/README.md index cd607bc0cf78..6c80c3976dc2 100644 --- a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/README.md +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/README.md @@ -1,8 +1,10 @@ This test shows how we handle modules the shadow a module in the standard library. -We manually replicate the behavior of `codeql database create --source-root `, which will use `-R `. By default, the way qltest invokes the extractor will cause different behavior. Therefore, we also need to move our code outside of the top-level folder, and it lives in `code/`. +We manually replicate the behavior of `codeql database create --source-root `, which will use `-R `. By default, the way qltest invokes the extractor will cause different behavior. Therefore, we also need to move our code outside of the top-level folder, and it lives in `code-invalid-package-name/` -- notice that if we use `code` as the folder name, the extractor will treat it as if there is a package called `code` (note, `codeql database create` would not the folder `code` as a package when `code` is used as the `--source-root`). -Because we have a `cmd.py` file, whenever the python interpreter sees `import cmd`, that is the file that will be used! -- +The results from `LocalModules.ql`, where everything is a script, matches with the extractor :+1: + +Because we have a `cmd.py` file, whenever the python interpreter sees `import cmd`, that is the file that will be used! * `python test_ok.py` works as intended, and prints `Foo` * `python test_fail.py` raises an exception, since it imports `pdb.py` from the standard library, which (at least in Python 3.8) tries to import `cmd.py` from the standard library, but instead is served our `cmd.py` module. Therefore it fails with `AttributeError: module 'cmd' has no attribute 'Cmd'` diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/cmd.py b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/code-invalid-package-name/cmd.py similarity index 100% rename from python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/cmd.py rename to python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/code-invalid-package-name/cmd.py diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/test_fail.py b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/code-invalid-package-name/test_fail.py similarity index 100% rename from python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/test_fail.py rename to python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/code-invalid-package-name/test_fail.py diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/test_ok.py b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/code-invalid-package-name/test_ok.py similarity index 100% rename from python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/test_ok.py rename to python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/code-invalid-package-name/test_ok.py diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/unique_name.py b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/code-invalid-package-name/unique_name.py similarity index 100% rename from python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/unique_name.py rename to python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/code-invalid-package-name/unique_name.py diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/unique_name_use.py b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/code-invalid-package-name/unique_name_use.py similarity index 100% rename from python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/unique_name_use.py rename to python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/code-invalid-package-name/unique_name_use.py diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/options b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/options index b91afde07678..ee0f5414146c 100644 --- a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/options +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/options @@ -1 +1 @@ -semmle-extractor-options: --max-import-depth=2 +semmle-extractor-options: --max-import-depth=2 -R code-invalid-package-name/ From 7b4e890e7b7ce24467249323f0d251ca1bb708c1 Mon Sep 17 00:00:00 2001 From: Rasmus Wriedt Larsen Date: Fri, 27 Nov 2020 11:00:30 +0100 Subject: [PATCH 3/3] Python: Fix grammar Co-authored-by: Taus --- .../wrong/module-imports/conflict-stdlib/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/README.md b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/README.md index 6c80c3976dc2..666e3c4bd2a2 100644 --- a/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/README.md +++ b/python/ql/test/library-tests/PointsTo/regressions/wrong/module-imports/conflict-stdlib/README.md @@ -1,6 +1,6 @@ -This test shows how we handle modules the shadow a module in the standard library. +This test shows how we handle modules that shadow a module in the standard library. -We manually replicate the behavior of `codeql database create --source-root `, which will use `-R `. By default, the way qltest invokes the extractor will cause different behavior. Therefore, we also need to move our code outside of the top-level folder, and it lives in `code-invalid-package-name/` -- notice that if we use `code` as the folder name, the extractor will treat it as if there is a package called `code` (note, `codeql database create` would not the folder `code` as a package when `code` is used as the `--source-root`). +We manually replicate the behavior of `codeql database create --source-root `, which will use `-R `. By default, the way qltest invokes the extractor will cause different behavior. Therefore, we also need to move our code outside of the top-level folder, and it lives in `code-invalid-package-name/` -- notice that if we use `code` as the folder name, the extractor will treat it as if there is a package called `code` (note, `codeql database create` would not treat the folder `code` as a package when `code` is used as the `--source-root`). The results from `LocalModules.ql`, where everything is a script, matches with the extractor :+1: