updated tests
Gitea Actions For prodir / Explore-Gitea-Actions (push) Failing after 0s Details

This commit is contained in:
Falko Victor Habel 2025-04-22 17:07:52 +02:00
parent eec232ae53
commit 048c275b55
1 changed files with 43 additions and 9 deletions

View File

@ -67,16 +67,50 @@ def test_display_verbose(tmp_path):
# Only check if we got any output, ignoring encoding errors # Only check if we got any output, ignoring encoding errors
assert stdout != "" or stderr != "" assert stdout != "" or stderr != ""
# ... rest of code here ...
# ... rest of code here ...
def test_create_directory_from_file(tmp_path): def test_create_directory_from_file(tmp_path):
structure_file = tmp_path / 'structure.txt' # Define the desired directory structure in a string with proper indentation
structure_content = "dir1/\n file1.txt" structure_content = """data/
structure_file.write_text(structure_content) 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 = tmp_path / 'output'
output_dir.mkdir() output_dir.mkdir()
stdout, stderr = run_prodir(['create', str(structure_file), '-o', str(output_dir)]) stdout, stderr = run_prodir(['create', "example.md" '-o'])
assert os.path.exists(output_dir / 'dir1' / 'file1.txt')
# 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): def test_create_verbose(tmp_path):
structure_file = tmp_path / 'structure.txt' structure_file = tmp_path / 'structure.txt'
@ -86,9 +120,9 @@ def test_create_verbose(tmp_path):
output_dir = tmp_path / 'output' output_dir = tmp_path / 'output'
output_dir.mkdir() 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 # 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(): def test_display_invalid_path():
# Use an absolute path with some random UUID to ensure it doesn't exist # Use an absolute path with some random UUID to ensure it doesn't exist