Exemple #1
0
    def post_command(self):
        # Copy all the tracing artifacts here if not present already (e.g.
        # if session was a local shell)
        if not op.exists(self.local_trace_dir):
            for fname in ["tracer.log", "trace.sqlite3"]:
                self.session.get(op.join(self.remote_trace_dir, fname),
                                 op.join(self.local_trace_dir, fname))
            lgr.info("Copied tracing artifacts under %s", self.local_trace_dir)
        else:
            lgr.debug(
                "Not copying %s from remote session "
                "since already exists locally", self.local_trace_dir)

        from reprozip.tracer.trace import write_configuration
        from rpaths import Path

        # we rely on hardcoded paths in reprozip
        write_configuration(directory=Path(self.local_trace_dir),
                            sort_packages=False,
                            find_inputs_outputs=True)

        from reproman.api import retrace
        reproman_spec_path = op.join(self.local_trace_dir, "reproman.yml")
        retrace(spec=op.join(self.local_trace_dir, "config.yml"),
                output_file=reproman_spec_path,
                resref=self.session)
        lgr.info("ReproMan trace %s", reproman_spec_path)
Exemple #2
0
def test_venv_pyc(venv_test_dir, tmpdir):
    from reproman.api import retrace
    tmpdir = str(tmpdir)
    venv_path = op.join("lib", PY_VERSION, "site-packages", "attr")
    pyc_path = op.join(
        venv_test_dir, "venv1", venv_path, "__pycache__",
        "exceptions.cpython-{v.major}{v.minor}.pyc".format(v=sys.version_info))

    if not op.exists(pyc_path):
        pytest.skip("Expected file does not exist: {}".format(pyc_path))

    distributions, unknown_files = retrace([pyc_path])
    assert not unknown_files
    assert len(distributions) == 1
    expect = {"environments":
              [{"packages": [{"files": [op.join(venv_path, "exceptions.py")],
                              "name": "attrs",
                              "editable": False}]}]}
    assert_is_subset_recur(expect,
                           attr.asdict(distributions[0]), [dict, list])