Skip to content

Instantly share code, notes, and snippets.

View hackebrot's full-sized avatar
💻
Focusing

Raphael Aurich hackebrot

💻
Focusing
View GitHub Profile
@hackebrot
hackebrot / test_sushi.py
Created November 21, 2021 16:16
Tests using pytest fixtures
from dataclasses import dataclass, field
from typing import List
import pytest
@dataclass(frozen=True)
class Ingredient:
name: str
plant_based: bool
@hackebrot
hackebrot / android-components.csv
Created December 11, 2020 17:06 — forked from mdboom/android-components.csv
Glean testing coverage
category name tested
basic os False
bookmarks_sync failure_reason False
bookmarks_sync finished_at False
bookmarks_sync incoming False
bookmarks_sync outgoing False
bookmarks_sync outgoing_batches False
bookmarks_sync remote_tree_problems False
bookmarks_sync started_at False
bookmarks_sync uid False
@hackebrot
hackebrot / labels.toml
Last active February 7, 2019 12:30
GitHub labels with Night Owl colors
# Colors from https://github.com/sdras/night-owl-vscode-theme
# Update your GitHub labels with https://github.com/hackebrot/labels
[bug]
color = "ffeb95"
description = "Bugs and problems with labels"
name = "bug"
["code quality"]
color = "c792ea"
diff --git a/build/virtualenv_packages.txt b/build/virtualenv_packages.txt
--- a/build/virtualenv_packages.txt
+++ b/build/virtualenv_packages.txt
@@ -77,4 +77,5 @@ mozilla.pth:third_party/python/pyasn1
mozilla.pth:third_party/python/pyasn1-modules
mozilla.pth:third_party/python/rsa
mozilla.pth:third_party/python/PyECC
+mozilla.pth:toolkit/components/telemetry/tests/marionette/harness
optional:packages.txt:comm/build/virtualenv_packages.txt
diff --git a/testing/marionette/mach_commands.py b/testing/marionette/mach_commands.py
@hackebrot
hackebrot / README.md
Last active July 6, 2017 20:28
Python class setup

Run pytest and show prints:

$ pytest -v -s
test_helloworld.py::TestHello::test_python [TestHello.setUpClass] PASSED
test_helloworld.py::TestHello::test_world PASSED
test_helloworld.py::TestHey::test_world [TestHey.setup_class] PASSED
@hackebrot
hackebrot / Makefile
Created February 14, 2017 23:57
gvt fetch for existing project
.DEFAULT_GOAL := help
define filterstdlib
go list -f '{{ if not .Standard }}{{ .ImportPath }}{{ end }}'
endef
define getimports
go list -f '{{ join .Imports "\n" }}'
endef
addprx = "!f() { b=`git symbolic-ref -q --short HEAD` && \
echo \"Making branch for pull request #$1 [pr/$1]\" && \
git fetch origin pull/$1/head:pr/$1 && \
echo \"Rebasing pr/$1 onto $b...\" && \
git fetch -q -f origin pull/$1/merge:refs/PR_MERGE_HEAD && \
git rebase -q --onto $b PR_MERGE_HEAD^ pr/$1 && \
git checkout -q $b && echo && \
git diff --stat $b..pr/$1 && echo && \
git log --oneline $b..pr/$1; \
git update-ref -d refs/PR_MERGE_HEAD; \
@hackebrot
hackebrot / conftest.py
Last active August 11, 2016 14:44
Skipped test should be an error
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
outcome = yield
rep = outcome.get_result()
if pytest.config.getoption('--error-for-skips'):
if rep.skipped and call.excinfo.errisinstance(pytest.skip.Exception):
rep.outcome = 'failed'
r = call.excinfo._getreprcrash()
rep.longrepr = 'Skipped test - {message}'.format(message=r.message)
@hackebrot
hackebrot / skipping.py
Last active August 5, 2016 17:35
1546
elif call.when == "call":
strict_default = item.config.getini('xfail_strict')
is_strict_xfail = evalxfail.get('strict', strict_default)
# TODO: xpass outcome
if is_strict_xfail:
rep.outcome = "failed"
else:
rep.outcome = "passed"
rep.wasxfail = evalxfail.getexplanation()
@hackebrot
hackebrot / conftest.py
Last active August 3, 2016 07:18
Report tests as failures
# -*- coding: utf-8 -*-
import random
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item):
outcome = yield
rep = outcome.get_result()