Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pomponchik committed Nov 13, 2023
1 parent dd14054 commit b4953bb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 0 additions & 2 deletions tests/cli/data/main.py

This file was deleted.

24 changes: 23 additions & 1 deletion tests/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import shutil

import pytest
from contextif import state


@pytest.mark.timeout(180)
Expand Down Expand Up @@ -118,6 +119,7 @@ def test_exceptions_are_similar_with_just_python_command_2():
os.remove(script)


@pytest.mark.skip(reason="Now it's not so actual.")
def test_install_package_from_another_repository(main_runner):
strings = [
'import super_test # instld: package super_test_project, version 0.0.1, index_url https://test.pypi.org/simple/, catch_output true',
Expand All @@ -131,7 +133,27 @@ def test_install_package_from_another_repository(main_runner):
for runner in (subprocess.run, main_runner):
result = runner(['instld', script], stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=100, universal_newlines=True)

print(result.stderr)
result.check_returncode()

assert result.stdout == '5\n'


os.remove(script)


def test_install_package_from_another_repository_only_command():
strings = [
'import super_test # instld: package super_test_project, version 0.0.1, index_url https://test.pypi.org/simple/, catch_output true',
'print(super_test.function(2, 3))',
]

script = os.path.join('tests', 'cli', 'data', 'main.py')
with open(script, 'w') as file:
file.write('\n'.join(strings))

for runner in (subprocess.run,):
result = runner(['instld', script], stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=100, universal_newlines=True)

result.check_returncode()

assert result.stdout == '5\n'
Expand Down

0 comments on commit b4953bb

Please sign in to comment.