Skip to content

Commit

Permalink
github_actions: use unittest instead of nose
Browse files Browse the repository at this point in the history
  • Loading branch information
ader1990 committed Nov 3, 2023
1 parent 77e1f71 commit e444acb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pymi-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
max-parallel: 100
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11"]

steps:
- uses: actions/checkout@v4
Expand All @@ -24,9 +24,9 @@ jobs:
pip install -r requirements.txt || exit /b
pip install nose testtools wheel || exit /b
pip install . || exit /b
nosetests wmi || exit /b
python -m unittest discover || exit /b
python setup.py bdist_wheel || exit /b
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v3
with:
name: pymi_wheel_py${{ matrix.python-version }}
path: 'dist'
18 changes: 11 additions & 7 deletions wmi/tests/functional/test_basic_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.

import os
import time

import wmi
Expand Down Expand Up @@ -47,12 +46,17 @@ def test_invoke_method(self, temp_file_path):
self.assertEqual(content, actual_content)

def test_associators(self):
logical_disk = self._conn_cimv2.Win32_LogicalDisk()[0]
root_dir = logical_disk.associators(
wmi_association_class="Win32_LogicalDiskRootDirectory")[0]

self.assertEqual(logical_disk.Name.lower(),
root_dir.Name.lower().strip('\\'))
logical_disks = self._conn_cimv2.Win32_LogicalDisk()
found_associators = False
for logical_disk in logical_disks:
root_dirs = logical_disk.associators(
wmi_association_class="Win32_LogicalDiskRootDirectory")
if len(root_dirs) == 1:
found_associators = True
root_dir = root_dirs[0]
self.assertEqual(logical_disk.Name.lower(),
root_dir.Name.lower().strip('\\'))
self.assertTrue(found_associators)

def test_new_conn_invalid_creds(self):
err_code = None
Expand Down
3 changes: 3 additions & 0 deletions wmi/tests/functional/test_timeouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import os
import time
import unittest

import wmi
from wmi.tests.functional import test_base
Expand All @@ -31,6 +32,8 @@ def _check_op_timeout(self, f, *args, **kwargs):
operation_options={'operation_timeout': 0.001},
**kwargs)

@unittest.skipIf(os.getenv("GITHUB_ACTIONS") == "true",
"Skipping on GitHub actions")
def test_query(self):
self._check_op_timeout(self._conn_cimv2.Win32_Process)

Expand Down

0 comments on commit e444acb

Please sign in to comment.