-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
86 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,5 @@ dist/ | |
env/ | ||
venv | ||
.pytest_cache/ | ||
__test_c/ | ||
__test_conan_home/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
conan==1.* | ||
pytest>=7, <9.0.0 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pytest | ||
import shutil | ||
import time | ||
|
||
from types import SimpleNamespace | ||
|
||
from bincrafters_conan_remote.remote import run_remote_in_thread | ||
from bincrafters_conan_remote.test.helpers import cli_command, env_vars | ||
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def setup_module(): | ||
run_remote_in_thread(SimpleNamespace(port=8042)) | ||
print("Sleeping for 10 seconds...") | ||
time.sleep(10) | ||
print("Done sleeping") | ||
shutil.rmtree(env_vars["CONAN_HOME"], ignore_errors=True) | ||
cli_command(["conan", "user"]) # TODO: Switch ConanV1 / ConanV2 | ||
cli_command(["conan", "config", "set", "general.revisions_enabled=1"]) # TODO: Switch ConanV1 / ConanV2 | ||
cli_command(["conan", "remote", "remove", "conancenter"]) | ||
cli_command(["conan", "remote", "add", "inexorgame", "http://127.0.0.1:8042/r/github+bincrafters_remote+testing_v-998+inexorgame/", "False"]) | ||
cli_command(["conan", "remote", "list"], expected_outputs=["inexorgame",]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from typing import List | ||
|
||
import os | ||
import subprocess | ||
|
||
_test_dir = os.path.dirname(os.path.abspath(__file__)) | ||
env_vars = { | ||
"CONAN_HOME": os.path.join(_test_dir, "__test_conan_home"), # ConanV2 | ||
"CONAN_USER_HOME": os.path.join(_test_dir, "__test_conan_home"), # ConanV1 | ||
"CONAN_USER_HOME_SHORT": os.path.join(_test_dir, "__test_c"), # ConanV1 | ||
"CONAN_LOGGING_LEVEL": "10", | ||
} | ||
|
||
def _run_command(command:List[str]): | ||
return subprocess.run(command, capture_output=True, text=True, env=env_vars) | ||
|
||
def cli_command(command:List[str], expected_returncode:int=0, expected_outputs:List[str]=[]): | ||
result = _run_command(command) | ||
|
||
print(f"{result.returncode} == {expected_returncode}: {result.stdout}") | ||
assert result.returncode == expected_returncode | ||
|
||
for expected_output in expected_outputs: | ||
assert expected_output in result.stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from bincrafters_conan_remote.test.helpers import cli_command | ||
|
||
import pytest | ||
import time | ||
|
||
def test_download_revision_latest(): | ||
print("Sleeping for 25 seconds...") | ||
time.sleep(25) | ||
cli_command( | ||
["conan", "download", "-r", "inexorgame", "--recipe", "InexorGlueGen/0.6.11@inexorgame/stable"], | ||
expected_outputs=[ | ||
"Downloading conanmanifest.txt", | ||
"Downloading conanfile.py", | ||
"Downloading conan_sources.tgz"] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters