diff --git a/cli.py b/ordigi/cli.py similarity index 99% rename from cli.py rename to ordigi/cli.py index 1f2191e..31dd2b8 100755 --- a/cli.py +++ b/ordigi/cli.py @@ -1,6 +1,7 @@ #!/usr/bin/env python import os +from pathlib import Path import re import sys diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..6068493 --- /dev/null +++ b/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup() diff --git a/tests/test_cli.py b/tests/test_cli.py new file mode 100644 index 0000000..fecfd0c --- /dev/null +++ b/tests/test_cli.py @@ -0,0 +1,34 @@ +from imp import load_source +from pathlib import Path +from click.testing import CliRunner +import pytest +import sys + +CONTENT = "content" + +import ipdb; ipdb.set_trace() +ordigi = load_source('cli', str(Path(__file__).parent.parent) + 'cli.py') + +class TestOrdigi: + + @pytest.fixture(autouse=True) + def setup_class(cls, sample_files_paths): + cls.runner = CliRunner() + cls.src_path, cls.file_paths = sample_files_paths + + def test__sort(self): + import ipdb; ipdb.set_trace() + result = self.runner.invoke(cli._sort, [str(self.src_path)]) + + +def test_needsfiles(tmpdir): + assert tmpdir + + +def test_create_file(tmp_path): + directory = tmp_path / "sub" + directory.mkdir() + path = directory / "hello.txt" + path.write_text(CONTENT) + assert path.read_text() == CONTENT + assert len(list(tmp_path.iterdir())) == 1 diff --git a/tests/test_ordigi.py b/tests/test_ordigi.py deleted file mode 100644 index 2ede67b..0000000 --- a/tests/test_ordigi.py +++ /dev/null @@ -1,19 +0,0 @@ -import pytest - -CONTENT = "content" - -class TestOrdigi: - @pytest.mark.skip() - def test__sort(self): - assert 0 - -def test_needsfiles(tmpdir): - assert tmpdir - -def test_create_file(tmp_path): - d = tmp_path / "sub" - d.mkdir() - p = d / "hello.txt" - p.write_text(CONTENT) - assert p.read_text() == CONTENT - assert len(list(tmp_path.iterdir())) == 1 diff --git a/workflow.sh b/workflow.sh new file mode 100644 index 0000000..93d0aa0 --- /dev/null +++ b/workflow.sh @@ -0,0 +1,12 @@ +# Create virtual environment +nmkvirtualenv ordigi + +# Work on it (activate and cd) +workon ordigi + +# Install required dependencies +pip install -r requirements.txt + +# Install it +pip install -e . +