Repository 'tool_factory_2'
hg clone https://toolshed.g2.bx.psu.edu/repos/fubar/tool_factory_2

Changeset 102:c632db66f8c0 (2020-11-26)
Previous changeset 101:557d5f06f213 (2020-11-26) Next changeset 103:2ca51677d6d1 (2020-11-27)
Commit message:
Uploaded
modified:
toolfactory/rgToolFactory2.py
b
diff -r 557d5f06f213 -r c632db66f8c0 toolfactory/rgToolFactory2.py
--- a/toolfactory/rgToolFactory2.py Thu Nov 26 06:17:12 2020 +0000
+++ b/toolfactory/rgToolFactory2.py Thu Nov 26 06:26:28 2020 +0000
[
b'@@ -766,191 +766,6 @@\n         container.remove()\n         shutil.rmtree(testouts)\n \n-\n-    def planemo_biodocker_vol_test(self):\n-        """planemo currently leaks dependencies if used in the same container and gets unhappy after a\n-        first successful run. https://github.com/galaxyproject/planemo/issues/1078#issuecomment-731476930\n-\n-        Docker biocontainer has planemo with caches filled to save repeated downloads\n-        Cannot get volumes to work right in this version\n-\n-        """\n-        if os.path.exists(self.tlog):\n-            tout = open(self.tlog, "a")\n-        else:\n-            tout = open(self.tlog, "w")\n-        planemoimage = "quay.io/fubar2/planemo-biocontainer"\n-        xreal = "%s.xml" % self.tool_name\n-        repname = f"{self.tool_name}_planemo_test_report.html"\n-        ptestrep_path = os.path.join(self.repdir,repname)\n-        tool_name = self.tool_name\n-        workdir = "export"\n-        aworkdir = os.path.abspath(workdir)\n-        os.makedirs(workdir, exist_ok=True)\n-        os.chmod(workdir,0o777)\n-        imworkdir = "/export"\n-        # must be mounted as a volume\n-        tooldir = os.path.join(workdir,self.tool_name)\n-        testdir = os.path.join(tooldir,\'test-data\')\n-        imtooldir = os.path.join(imworkdir,self.tool_name)\n-        imtestdir = os.path.join(imtooldir,\'test-data\')\n-        for d in [tooldir,testdir]:\n-            if not os.path.exists(d):\n-                os.mkdir(d)\n-        with os.scandir(self.testdir) as outs:\n-            for entry in outs:\n-                if not entry.is_file():\n-                    continue\n-                src = os.path.join(self.testdir, entry.name)\n-                dest = os.path.join(testdir, entry.name)\n-                shutil.copyfile(src, dest)\n-        shutil.copyfile(xreal,os.path.join(tooldir,xreal))\n-        client = docker.from_env()\n-        # mnt = docker.types.Mount(source=\'workdir\', target=imworkdir) # mounts=[mnt],)\n-        atestcl = "ls -lt /export"\n-        container = client.containers.run(planemoimage,atestcl,\n-           volumes={aworkdir:{\'bind\':\'/export\',\'mode\':\'rw\'}}, )\n-        tout.write(f"## Ran {atestcl} and got {container}")\n-        ptestpath = os.path.join(imtooldir,xreal)\n-        ptestcll = f"planemo test --job_output_files {imtooldir} --update_test_data --test_data {imtestdir} --galaxy_root /home/biodocker/galaxy-central {ptestpath}"\n-        try:\n-            container = client.containers.run(planemoimage,ptestcl,\n-               volumes={aworkdir:{\'bind\':\'/export\',\'mode\':\'rw\'}}, )\n-        except:\n-            pass\n-        tout.write(f"## Ran {ptestcl}")\n-        with os.scandir(testdir) as outs:\n-            for entry in outs:\n-                if not entry.is_file():\n-                    continue\n-                src = os.path.join(testdir, entry.name)\n-                dest = os.path.join(self.testdir, entry.name)\n-                shutil.copyfile(src, dest)\n-        imrep_path = os.path.join(imtooldir,repname)\n-        ptestcl = f"planemo test --job_output_files {imtooldir}  --test_output {imrep_path} --test_data {imtestdir} --galaxy_root /home/biodocker/galaxy-central {ptestpath}"\n-        try:\n-            container = client.containers.run(planemoimage,ptestcl,\n-               volumes={aworkdir:{\'bind\':\'/export\',\'mode\':\'rw\'}}, )\n-        except:\n-            pass\n-        tout.write(f"## Ran {ptestcl}")\n-        if os.path.isfile(imrep_path):\n-            shutil.copyfile(imrep_path,ptestrep_path)\n-        else:\n-            tout.write(f"## planemo_biodocker_test - no test report {imrep_path} found")\n-        tout.close()\n-        #shutil.rmtree(workdir)\n-\n-\n-\n-    def gal_tool_test(self):\n-        """\n-        On path should be a handy script writes test outputs even if they don\'t exist\n-\n-        galaxy-tool-test -u http://localhost:8080 -a 3c9afe09f1b7892449d266109639c104 -o /tmp/foo -t hello -j /tmp/foo/hello.json --verbose\n-\n-       leaves outputs in -o !\n-        """\n-        gttscript = f""'..b'galaxy tool tester run_test.sh\n-\n-        export GALAXY_TEST_SAVE="./foo" && export GALAXY_TEST_NO_CLEANUP="1" \\\n-        && export GALAXY_TEST_TMP_DIR=./foo && sh run_tests.sh --id rgtf2 --report_file tool_tests_tool_conf.html functional.test_toolbox\n-\n-        """\n-        testdir = tempfile.mkdtemp(suffix=None, prefix="tftemp",dir="/tmp")\n-        tool_test_rep = f"{self.tool_name}_galaxy_test_report_html.html"\n-        if os.path.exists(self.tlog):\n-            tout = open(self.tlog, "a")\n-        else:\n-            tout = open(self.tlog, "w")\n-\n-        fakeenv  = copy.copy(os.environ)\n-        fakeenv["GALAXY_TEST_SAVE"] = testdir\n-        fakeenv["GALAXY_TEST_NO_CLEANUP"] = "1"\n-        fakeenv["GALAXY_TEST_TMP_DIR"] = testdir\n-        galaxy_lib = os.path.join(self.args.galaxy_root,\'lib\')\n-\n-        cll = [\n-       "sh", f"{self.args.galaxy_root}/run_tests.sh", "--id", self.tool_name,\n-       "--report_file", os.path.join(testdir,tool_test_rep), "functional.test_toolbox",\n-        ]\n-        subp = subprocess.run(\n-            cll, env = fakeenv ,\n-            shell=False, cwd=galaxy_lib, stderr=tout, stdout=tout\n-        )\n-        src = os.path.join(testdir, tool_test_rep)\n-        if os.path.isfile(src):\n-            dest = os.path.join(self.repdir, tool_test_rep)\n-            shutil.copyfile(src, dest)\n-        else:\n-            tout.write(f"### {src} not found\\n")\n-        tout.close()\n-        return subp.returncode\n-\n-\n     def shedLoad(self):\n         """\n         {\'deleted\': False,\n@@ -1224,66 +1039,6 @@\n         tout.close()\n         return subp.returncode\n \n-    def planemo_test(self, genoutputs=True):\n-        """planemo is a requirement so is available for testing but needs a different call if\n-        in the biocontainer - see above\n-        and for generating test outputs if command or test overrides are supplied\n-        test outputs are sent to repdir for display\n-        planemo test --engine docker_galaxy  --galaxy_root /galaxy-central pyrevpos/pyrevpos.xml\n-\n-        Planemo runs:\n-python ./scripts/functional_tests.py -v --with-nosehtml --html-report-file\n-/export/galaxy-central/database/job_working_directory/000/17/working/TF_run_report_tempdir/tacrev_planemo_test_report.html\n---with-xunit --xunit-file /tmp/tmpt90p7f9h/xunit.xml --with-structureddata\n---structured-data-file\n-/export/galaxy-central/database/job_working_directory/000/17/working/tfout/tool_test_output.json functional.test_toolbox\n-\n-\n-        for the planemo-biocontainer,\n-        planemo test --conda_dependency_resolution --skip_venv --galaxy_root /galthrow/ rgToolFactory2.xml\n-\n-        """\n-        xreal = "%s.xml" % self.tool_name\n-        tool_test_path = os.path.join(self.repdir,f"{self.tool_name}_planemo_test_report.html")\n-        if os.path.exists(self.tlog):\n-            tout = open(self.tlog, "a")\n-        else:\n-            tout = open(self.tlog, "w")\n-        if genoutputs:\n-            dummy, tfile = tempfile.mkstemp()\n-            cll = [\n-                "planemo",\n-                "test",\n-                "--galaxy_root",\n-                self.args.galaxy_root,\n-                "--update_test_data",\n-                xreal,\n-            ]\n-            subp = subprocess.run(\n-                cll,\n-                env=self.ourenv,\n-                shell=False,\n-                cwd=self.testdir,\n-                stderr=dummy,\n-                stdout=dummy,\n-            )\n-\n-        else:\n-            cll = [\n-                "planemo",\n-                "test",\n-                "--test_data", self.testdir,\n-                "--test_output",tool_test_path,\n-                "--galaxy_root",\n-                self.args.galaxy_root,\n-                xreal,\n-            ]\n-            subp = subprocess.run(\n-                cll, env=self.ourenv, shell=False, cwd=self.testdir, stderr=tout, stdout=tout\n-            )\n-        tout.close()\n-        return subp.returncode\n-\n \n     def writeShedyml(self):\n         """for planemo"""\n'