def test_priority_of_loading_library_after_setup_pack_virtualenv(self):
        """
        This test checks priority of loading library, whether the library which is specified in
        the 'requirements.txt' of pack is loaded when a same name module is also specified in the
        'requirements.txt' of st2, at a subprocess in ActionRunner.

        To test above, this uses 'get_library_path.py' action in 'test_library_dependencies' pack.
        This action returns file-path of imported module which is specified by 'module' parameter.
        """
        pack_name = TEST_LIBRARY_DEPENDENCIES

        # Before calling action, this sets up virtualenv for test pack. This pack has
        # requirements.txt wihch only writes 'six' module.
        setup_pack_virtualenv(pack_name=pack_name)
        self.assertTrue(os.path.exists(os.path.join(self.virtualenvs_path, pack_name)))

        # This test suite expects that loaded six module is located under the virtualenv library,
        # because 'six' is written in the requirements.txt of 'test_library_dependencies' pack.
        (_, output, _) = self._run_action(
            pack_name, "get_library_path.py", {"module": "six"}
        )
        # FIXME: This test fails if system site-packages has six because
        # it won't get installed in the virtualenv (w/ --system-site-packages)
        # system site-packages is never from a virtualenv.
        # Travis has python installed in /opt/python/3.6.7
        # with a no-system-site-packages virtualenv at /home/travis/virtualenv/python3.6.7
        # GitHub Actions python is in /opt/hostedtoolcache/Python/3.6.13/x64/
        # But ther isn't a virtualenv, so when we pip installed `virtualenv`,
        # (which depends on, and therefore installs `six`)
        # we installed it in system-site-packages not an intermediate virtualenv
        self.assertEqual(output["result"].find(self.virtualenvs_path), 0)

        # Conversely, this expects that 'mock' module file-path is not under sandbox library,
        # but the parent process's library path, because that is not under the pack's virtualenv.
        (_, output, _) = self._run_action(
            pack_name, "get_library_path.py", {"module": "mock"}
        )
        self.assertEqual(output["result"].find(self.virtualenvs_path), -1)

        # While a module which is in the pack's virtualenv library is specified at 'module'
        # parameter of the action, this test suite expects that file-path under the parent's
        # library is returned when 'sandbox' parameter of PythonRunner is False.
        (_, output, _) = self._run_action(
            pack_name, "get_library_path.py", {"module": "six"}, {"_sandbox": False}
        )
        self.assertEqual(output["result"].find(self.virtualenvs_path), -1)

        This test checks priority of loading library, whether the library which is specified in
        the 'requirements.txt' of pack is loaded when a same name module is also specified in the
        'requirements.txt' of st2, at a subprocess in ActionRunner.

        To test above, this uses 'get_library_path.py' action in 'test_library_dependencies' pack.
        This action returns file-path of imported module which is specified by 'module' parameter.
        
contrib/runners/python_runner/tests/integration/test_pythonrunner_behavior.py