@@ -0,0 +1,1753 @@
+%22%22%22Test the %60%60dtool dataset copy%60%60 command.%22%22%22%0A%0Aimport os%0A%0Afrom click.testing import CliRunner%0A%0Afrom dtoolcore import DataSet, ProtoDataSet%0A%0Afrom . import chdir_fixture, tmp_dir_fixture  # NOQA%0A%0A%0Adef test_dataset_copy_functional(chdir_fixture):  # NOQA%0A    from dtool_create.dataset import create, freeze, add, copy%0A    runner = CliRunner()%0A%0A    dataset_name = %22my_dataset%22%0A    result = runner.invoke(create, %5Bdataset_name%5D)%0A    assert result.exit_code == 0%0A%0A    # At this point we have a proto dataset%0A    dataset_abspath = os.path.abspath(dataset_name)%0A    dataset_uri = %22file://%7B%7D%22.format(dataset_abspath)%0A    dataset = ProtoDataSet.from_uri(dataset_uri)%0A%0A    # Create a directory to copy the dataset to.%0A    copy_directory = os.path.abspath(%22copy_dir%22)%0A    os.mkdir(copy_directory)%0A%0A    # It should not be possible to copy a proto dataset.%0A    result = runner.invoke(copy, %5Bdataset_uri, copy_directory%5D)%0A    assert result.exit_code != 0%0A%0A    # Create sample file to the proto dataset.%0A    sample_file_name = %22hello.txt%22%0A    with open(sample_file_name, %22w%22) as fh:%0A        fh.write(%22hello world%22)%0A%0A    # Put it into the dataset%0A    result = runner.invoke(add, %5B%22item%22, sample_file_name, dataset_uri%5D)%0A    assert result.exit_code == 0%0A%0A    result = runner.invoke(freeze, %5Bdataset_uri%5D)%0A    assert result.exit_code == 0%0A%0A    # Now we have a dataset.%0A    dataset = DataSet.from_uri(dataset_uri)%0A%0A    # It should now be possible to copy the dataset.%0A    result = runner.invoke(copy, %5Bdataset_uri, copy_directory%5D)%0A    assert result.exit_code == 0%0A%0A    # However, it cannot be done again.%0A    result = runner.invoke(copy, %5Bdataset_uri, copy_directory%5D)%0A    assert result.exit_code != 0%0A    assert result.output.find(%22Error: Dataset already exists%22) != -1%0A

Add 'dtool copy' functional test