Skip to content

Commit

Permalink
[DATALAD RUNCMD] git-sedi NicemanProvenance RepromanProve...
Browse files Browse the repository at this point in the history
=== Do not change lines below ===
{
 "chain": [],
 "cmd": "git-sedi NicemanProvenance RepromanProvenance",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
  • Loading branch information
yarikoptic committed Jan 17, 2019
1 parent 4f0c3c7 commit e2972f0
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions reproman/distributions/tests/test_conda.py
Expand Up @@ -16,7 +16,7 @@
import yaml
import attr

from reproman.formats.reproman import NicemanProvenance
from reproman.formats.reproman import RepromanProvenance
from reproman.tests.utils import create_pymodule
from reproman.tests.utils import skip_if_no_network, assert_is_subset_recur

Expand Down Expand Up @@ -216,7 +216,7 @@ def test_conda_init_install_and_detect():

(distributions, unknown_files) = dists[0]

# NicemanProvenance.write(sys.stdout, distributions)
# RepromanProvenance.write(sys.stdout, distributions)

assert distributions.platform.startswith(
get_conda_platform_from_python(sys.platform)), \
Expand Down Expand Up @@ -286,7 +286,7 @@ def raise_other(_):
conda_yaml = os.path.join(os.path.dirname(__file__), 'files', 'conda.yaml')

def test_conda_packages():
env = NicemanProvenance(conda_yaml).get_environment()
env = RepromanProvenance(conda_yaml).get_environment()
conda_dist = env.get_distribution(CondaDistribution)
assert isinstance(conda_dist.packages, list)
assert len(conda_dist.packages) == 4
6 changes: 3 additions & 3 deletions reproman/distributions/tests/test_environment.py
Expand Up @@ -9,7 +9,7 @@

from os.path import join as opj, dirname, pardir
from pytest import raises
from reproman.formats.reproman import NicemanProvenance
from reproman.formats.reproman import RepromanProvenance
from reproman.distributions.debian import DebianDistribution
from reproman.distributions.conda import CondaDistribution

Expand All @@ -18,11 +18,11 @@
diff_1_yaml = opj(yaml_dir, 'diff_1.yaml')

def test_get_distributions():
env = NicemanProvenance(multi_debian_yaml).get_environment()
env = RepromanProvenance(multi_debian_yaml).get_environment()
with raises(ValueError):
env.get_distribution(DebianDistribution)
dist = env.get_distribution(CondaDistribution)
assert dist is None
env = NicemanProvenance(diff_1_yaml).get_environment()
env = RepromanProvenance(diff_1_yaml).get_environment()
dist = env.get_distribution(DebianDistribution)
assert isinstance(dist, DebianDistribution)
2 changes: 1 addition & 1 deletion reproman/formats/niceman.py
Expand Up @@ -35,7 +35,7 @@
__version__ = '0.0.1'


class NicemanProvenance(Provenance):
class RepromanProvenance(Provenance):
"""
Parser for ReproMan Spec (YAML specification)
"""
Expand Down
14 changes: 7 additions & 7 deletions reproman/formats/tests/test_niceman.py
Expand Up @@ -26,30 +26,30 @@
from reproman.distributions.venv import VenvDistribution
from reproman.distributions.venv import VenvEnvironment
from reproman.distributions.venv import VenvPackage
from reproman.formats.reproman import NicemanProvenance
from reproman.formats.reproman import RepromanProvenance

from .constants import REPROMAN_SPEC1_YML_FILENAME


def test_write():
output = io.StringIO()
# just load
file_format = NicemanProvenance(REPROMAN_SPEC1_YML_FILENAME)
file_format = RepromanProvenance(REPROMAN_SPEC1_YML_FILENAME)
env = file_format.get_environment()
# just a basic test that we loaded stuff correctly
assert len(env.distributions) == 2
assert env.distributions[0].name == 'conda'
assert len(env.distributions[1].apt_sources) == 3
# and save
NicemanProvenance.write(output, env)
RepromanProvenance.write(output, env)
out = output.getvalue()
env_reparsed = NicemanProvenance(out).get_environment()
env_reparsed = RepromanProvenance(out).get_environment()
# and we could do the full round trip while retaining the same "value"
assert env == env_reparsed


def test_spec_round_trip():
# FIXME: This should also test GitDistribution's, but NicemanProvenance
# FIXME: This should also test GitDistribution's, but RepromanProvenance
# can't currently load those (gh-222).

spec = EnvironmentSpec(
Expand Down Expand Up @@ -137,6 +137,6 @@ def test_spec_round_trip():
VenvDistribution(name="venv1")])

output = io.StringIO()
NicemanProvenance.write(output, spec)
loaded = NicemanProvenance(output.getvalue()).get_environment()
RepromanProvenance.write(output, spec)
loaded = RepromanProvenance(output.getvalue()).get_environment()
assert spec == loaded
6 changes: 3 additions & 3 deletions reproman/interface/diff.py
Expand Up @@ -16,7 +16,7 @@
from ..support.constraints import EnsureStr
from ..support.exceptions import InsufficientArgumentsError
from ..support.param import Parameter
from reproman.formats.reproman import NicemanProvenance
from reproman.formats.reproman import RepromanProvenance
from ..distributions.debian import DebianDistribution
from ..distributions.conda import CondaDistribution
from ..distributions.vcs import GitDistribution, SVNDistribution
Expand Down Expand Up @@ -70,8 +70,8 @@ class Diff(Interface):
@staticmethod
def __call__(prov1, prov2, satisfies):

env_1 = NicemanProvenance(prov1).get_environment()
env_2 = NicemanProvenance(prov2).get_environment()
env_1 = RepromanProvenance(prov1).get_environment()
env_2 = RepromanProvenance(prov2).get_environment()

if satisfies:
return Diff.satisfies(env_1, env_2)
Expand Down
4 changes: 2 additions & 2 deletions reproman/interface/retrace.py
Expand Up @@ -127,9 +127,9 @@ def __call__(path=None, spec=None, output_file=None,
spec.files = sorted(files)

# TODO: generic writer!
from reproman.formats.reproman import NicemanProvenance
from reproman.formats.reproman import RepromanProvenance
stream = open(output_file, "w") if output_file else sys.stdout
NicemanProvenance.write(stream, spec)
RepromanProvenance.write(stream, spec)
if stream is not sys.stdout:
stream.close()

Expand Down
4 changes: 2 additions & 2 deletions reproman/interface/tests/test_execute.py
Expand Up @@ -19,7 +19,7 @@
import attr

from reproman.api import execute
from reproman.formats.reproman import NicemanProvenance
from reproman.formats.reproman import RepromanProvenance
from reproman.utils import swallow_outputs
from reproman.interface.execute import TracedCommand
from reproman.support.external_versions import external_versions
Expand Down Expand Up @@ -141,7 +141,7 @@ def test_trace_local(trace_info):
trace_dirs = os.listdir(op.join(local_dir, "traces"))
assert len(trace_dirs) == 1

prov = NicemanProvenance(op.join(local_dir, "traces",
prov = RepromanProvenance(op.join(local_dir, "traces",
trace_dirs[0], "reproman.yml"))
deb_dists = [dist for dist in prov.get_distributions()
if dist.name == "debian"]
Expand Down

0 comments on commit e2972f0

Please sign in to comment.