Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run pytype in GitHub Actions #85

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ jobs:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: pip3 install ruff
run: pip3 install asn1crypto atheris pytype ruff
- name: Run ruff checks
run: ruff check src
- name: Run pytype checks
run: pytype src
# mypy:
# runs-on: ubuntu-latest
# steps:
Expand Down
2 changes: 1 addition & 1 deletion src/coverage_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import atheris

with atheris.instrument_imports():
import coverage_test_helper
import coverage_test_helper # pytype: disable=import-error

# Enable RegEx instrumentation.
atheris.enabled_hooks.add("RegEx")
Expand Down
2 changes: 1 addition & 1 deletion src/custom_crossover_fuzz_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import atheris

import fuzz_test_lib
import fuzz_test_lib # pytype: disable=import-error


def concatenate_crossover(data1, data2, max_size, seed):
Expand Down
2 changes: 1 addition & 1 deletion src/custom_mutator_and_crossover_fuzz_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import atheris

import fuzz_test_lib
import fuzz_test_lib # pytype: disable=import-error


def noop_mutator(data, max_size, seed):
Expand Down
2 changes: 1 addition & 1 deletion src/custom_mutator_fuzz_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import atheris

import fuzz_test_lib
import fuzz_test_lib # pytype: disable=import-error


def compressed_mutator(data, max_size, seed):
Expand Down
2 changes: 1 addition & 1 deletion src/fuzz_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import atheris

import fuzz_test_lib
import fuzz_test_lib # pytype: disable=import-error


def fail_immediately(data):
Expand Down
4 changes: 2 additions & 2 deletions src/fuzzed_data_provider_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ def testInRange9(self):
self.assertLessEqual(result, one)

def testIntList1(self):
arr = b""
arr = bytearray()
for _ in range(0, 1000):
arr += to_bytes(random.randint(0, 255), 1)
fdp = atheris.FuzzedDataProvider(arr)
fdp = atheris.FuzzedDataProvider(bytes(arr))

l = fdp.ConsumeIntList(4321, 1) # noqa: E741
self.assertEqual(len(l), 4321)
Expand Down
6 changes: 3 additions & 3 deletions src/version_dependent.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def get_lnotab(code, listing):


elif (3, 11) <= PYTHON_VERSION <= (3, 11):
from .native import _generate_codetable
from .native import _generate_codetable # pytype: disable=import-error
def get_lnotab(code, listing):
ret = _generate_codetable(code, listing)
return ret
Expand Down Expand Up @@ -392,7 +392,7 @@ def parse_exceptiontable(code):


if (3, 11) <= PYTHON_VERSION <= (3, 11):
from .native import _generate_exceptiontable
from .native import _generate_exceptiontable # pytype: disable=import-error

def generate_exceptiontable(original_code, exception_table_entries): # noqa: F811
return _generate_exceptiontable(original_code, exception_table_entries)
Expand Down Expand Up @@ -497,7 +497,7 @@ def cache_count(op):
if isinstance(op, str):
op = dis.opmap[op]

return opcode._inline_cache_entries[op]
return getattr(opcode, '_inline_cache_entries')[op]

# Generate a list of CACHE instructions for the given instr.
def caches(op):
Expand Down
Loading