diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4e795f8..2ad1b42 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,15 +9,20 @@ jobs: - name: setup python uses: actions/setup-python@v4 + with: + python-version: '3.12' - name: install prerequisites run: | - pip install pytest + pip install -r requirements wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc sudo add-apt-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" sudo add-apt-repository "deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" sudo apt-get install -y qtbase5-dev lldb-17 sudo ln --force --symbolic /usr/bin/lldb-17 /usr/bin/lldb + - name: run linter + run: flake8 --verbose lldb_qt_formatters + - name: run tests run: pytest test --junitxml=test.xml --full-trace --verbose test diff --git a/.gitignore b/.gitignore index 7ab273a..63c5cc2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ build -venv \ No newline at end of file +venv + +.idea +__pycache__ \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a068b07..8463adc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,8 +18,9 @@ test-formatters: script: - python3 -m venv venv - source venv/bin/activate - - pip install pytest + - pip install -r requirements - echo "settings set target.load-cwd-lldbinit false" > ~/.lldbinit + - flake8 --verbose lldb_qt_formatters - pytest --junitxml=lldb_qt_formatters.xml --full-trace --verbose test artifacts: reports: diff --git a/lldb_qt_formatters/__init__.py b/lldb_qt_formatters/__init__.py index c8949c7..b3433c0 100755 --- a/lldb_qt_formatters/__init__.py +++ b/lldb_qt_formatters/__init__.py @@ -1,11 +1,12 @@ +# We need to import the formatters like this - no other method will work from .qstring import * from .qmap import * -def __lldb_init_module(debugger, dict): +def __lldb_init_module(debugger, internal_dict): init_commands = [ 'type summary add --python-function lldb_qt_formatters.qstring.format_summary "QString"', - 'type summary add --summary-string "\{${var.key}: ${var.value}\}" -x "QMapNode<.+>$"', + 'type summary add --summary-string "\{${var.key}: ${var.value}\}" -x "QMapNode<.+>$"', # noqa: W605 'type synthetic add --python-class lldb_qt_formatters.qmap.SyntheticChildrenProvider -x "QMap<.+>$"', 'type summary add --expand --python-function lldb_qt_formatters.qmap.format_summary -x "QMap<.+>$"' ] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..6a52125 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +flake8-bugbear +flake8 +pep8-naming +pytest \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..1f4ef62 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,3 @@ +[flake8] +max-line-length = 140 +extend-ignore = F401,F403