Browse Source

Pytest: Add automated testing tools. (#62)

* pytest: add first test demo.

* Pytest: trying error demo.

* Pytest: Cancel error test.
Yang Shuang 1 năm trước cách đây
mục cha
commit
a393fc440d
2 tập tin đã thay đổi với 20 bổ sung0 xóa
  1. 13 0
      .github/workflows/ubuntu-latest&gcc-4.9.yml
  2. 7 0
      tests/test_assert.py

+ 13 - 0
.github/workflows/ubuntu-latest&gcc-4.9.yml

@@ -35,10 +35,17 @@ jobs:
         sudo apt update
         sudo apt install gcc-4.9 g++-4.9
       shell: bash
+
+    - name: Set up Python 3.7
+      uses: actions/setup-python@v2
+      with:
+          python-version: "3.7"
       
     - name: install dependency
       run: |
         sudo apt-get install -y make zlib1g zlib1g-dev bzip2 liblz4-dev libasan0 openssl libmxml-dev
+        python -m pip install --upgrade pip
+        pip install pytest
       
     - name: cmake project
       run: |
@@ -101,3 +108,9 @@ jobs:
         mysql -h127.0.0.1 -uroot -p123456 -e "show databases;"
         mysql -h127.0.0.1 -uroot -p123456 -Dlayer2 -e "source ${{github.workspace}}/script/init_table.sql;"
         mysql -h127.0.0.1 -uroot -p123456 -Dlayer2 -e "show tables;"
+
+    - name: Testing CacheOnly
+
+      run: |
+        cd ${{github.workspace}}/tests
+        pytest

+ 7 - 0
tests/test_assert.py

@@ -0,0 +1,7 @@
+import pytest
+
+def test_demo():
+    assert 100 == 100
+
+#def test_failed():
+#    assert 200 == 100