Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekg committed Jul 3, 2023
1 parent 74456dc commit 132e7ed
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: ezekg
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on:
- windows-latest
- ubuntu-latest
- macos-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python-version}}
- name: Install
run: python -m pip install --upgrade pip
- name: Test
run: python -m unittest tests
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# py-machineid

[![CI](https://github.com/keygen-sh/py-machineid/actions/workflows/test.yml/badge.svg)](https://github.com/keygen-sh/py-machineid/actions)
[![PyPI version](https://badge.fury.io/py/py-machineid.svg)](https://badge.fury.io/py/py-machineid)

Get the unique machine ID of any host (without admin privileges).

Sponsored by:
Expand Down
25 changes: 25 additions & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from sys import platform

import machineid
import unittest

class TestMachineId(unittest.TestCase):
def test_hashed_id(self):
self.assertTrue(isinstance(machineid.hashed_id(), str))
self.assertTrue(len(machineid.hashed_id()) > 0)
self.assertTrue(machineid.hashed_id('foo') != machineid.hashed_id('bar'))
self.assertTrue(machineid.hashed_id('foo') != machineid.hashed_id())

def test_id(self):
self.assertTrue(isinstance(machineid.id(), str))
self.assertTrue(len(machineid.id()) > 0)

def test_registry(self):
if platform != 'win32':
return

self.assertTrue(isinstance(machineid.id(winregistry=False), str))
self.assertTrue(machineid.id(winregistry=False) != machineid.id(winregistry=True))

if __name__ == '__main__':
unittest.main()

0 comments on commit 132e7ed

Please sign in to comment.