develop #20
|
@ -67,16 +67,50 @@ def test_display_verbose(tmp_path):
|
|||
# Only check if we got any output, ignoring encoding errors
|
||||
assert stdout != "" or stderr != ""
|
||||
|
||||
|
||||
# ... rest of code here ...
|
||||
|
||||
# ... rest of code here ...
|
||||
|
||||
def test_create_directory_from_file(tmp_path):
|
||||
structure_file = tmp_path / 'structure.txt'
|
||||
structure_content = "dir1/\n file1.txt"
|
||||
structure_file.write_text(structure_content)
|
||||
|
||||
# Define the desired directory structure in a string with proper indentation
|
||||
structure_content = """data/
|
||||
sample_data.csv
|
||||
docs/
|
||||
README.md
|
||||
requirements.txt
|
||||
setup.py
|
||||
src/
|
||||
__init__.py
|
||||
main.py
|
||||
utils.py
|
||||
tests/
|
||||
__init__.py
|
||||
test_main.py
|
||||
test_utils.py"""
|
||||
|
||||
|
||||
output_dir = tmp_path / 'output'
|
||||
output_dir.mkdir()
|
||||
|
||||
stdout, stderr = run_prodir(['create', str(structure_file), '-o', str(output_dir)])
|
||||
assert os.path.exists(output_dir / 'dir1' / 'file1.txt')
|
||||
|
||||
stdout, stderr = run_prodir(['create', "example.md" '-o'])
|
||||
|
||||
# Print the stdout and stderr for debugging
|
||||
print("stdout:", stdout)
|
||||
print("stderr:", stderr)
|
||||
|
||||
|
||||
assert os.path.exists('my_project/data/sample_data.csv')
|
||||
assert os.path.exists('my_project/docs/README.md')
|
||||
assert os.path.exists('my_project/requirements.txt')
|
||||
assert os.path.exists('my_project/setup.py')
|
||||
assert os.path.exists('my_project/src/__init__.py')
|
||||
assert os.path.exists('my_project/src/main.py')
|
||||
assert os.path.exists('my_project/src/utils.py')
|
||||
assert os.path.exists('my_project/tests/__init__.py')
|
||||
assert os.path.exists('my_project/tests/test_main.py')
|
||||
assert os.path.exists('my_project/tests/test_utils.py')
|
||||
|
||||
|
||||
def test_create_verbose(tmp_path):
|
||||
structure_file = tmp_path / 'structure.txt'
|
||||
|
@ -86,9 +120,9 @@ def test_create_verbose(tmp_path):
|
|||
output_dir = tmp_path / 'output'
|
||||
output_dir.mkdir()
|
||||
|
||||
stdout, stderr = run_prodir(['create', str(structure_file), '-o', str(output_dir), '-v'])
|
||||
stdout, stderr = run_prodir(['create', "example.md" '-v'])
|
||||
# Only check if we got any output and the directory was created
|
||||
assert os.path.exists(output_dir / 'dir1' / 'file1.txt')
|
||||
assert os.path.exists( 'my_project/requirements.txt')
|
||||
|
||||
def test_display_invalid_path():
|
||||
# Use an absolute path with some random UUID to ensure it doesn't exist
|
||||
|
|
Loading…
Reference in New Issue