From b24d48a04282026a7e95f848fc2a2e69f0c2102c Mon Sep 17 00:00:00 2001 From: ssrlive <30760636+ssrlive@users.noreply.github.com> Date: Thu, 26 Sep 2024 11:02:33 +0800 Subject: [PATCH] testing python script issues --- .github/workflows/tests.yml | 26 ++++++++++++++++++++------ tests/tests.py | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9e6f1ab..c274674 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,10 +24,24 @@ jobs: env: DOTENV: ${{ secrets.DOTENV }} run: echo "$DOTENV" > .env + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Create virtual environment + run: python -m venv venv + + - name: Activate virtual environment and install dependencies + run: | + source venv/bin/activate + pip install -r tests/requirements.txt + + - name: Build project + run: cargo build --release + - name: Run tests - run: >- - pwd; - ls -la; - sudo python -m pip install -r tests/requirements.txt; - cargo build --release; - sudo python tests/tests.py \ No newline at end of file + run: | + source venv/bin/activate + python tests/tests.py diff --git a/tests/tests.py b/tests/tests.py index a2f4597..3ff9dff 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -40,7 +40,7 @@ class Tun2ProxyTest(unittest.TestCase): ip_noproxy = get_ip(ip_version) additional = ['-6'] if ip_version == 6 else [] p = subprocess.Popen( - [get_tool_path(), "--proxy", os.getenv(proxy_var), '--setup', '-v', 'trace', '--dns', dns, *additional]) + ['sudo', get_tool_path(), "--proxy", os.getenv(proxy_var), '--setup', '-v', 'trace', '--dns', dns, *additional]) try: time.sleep(1) ip_withproxy = get_ip(ip_version)