Skip to content

Instantly share code, notes, and snippets.

# First test with the default port, then test using a fixed port
# number.
@pytest.fixture(scope="module", params=[None, 9999])
def app(request):
app = App(port=request.param)
print("Starting app")
app.start()
yield app
print("Stopping app")
app.stop()
@pytest.fixture(scope="module")
def app():
app = App()
print("Starting app")
app.start()
yield app
print("Stopping app")
app.stop()
@pytest.fixture
def app():
app = App()
print("Starting app")
app.start()
yield app
print("Stopping app")
app.stop()
"""Example usage of pytest fixtures."""
import subprocess
import re
import pytest
import requests
class App:
@ryanc414
ryanc414 / app.go
Last active April 28, 2020 10:39
PyTest fixture examples
package main
import (
"flag"
"fmt"
"html"
"net"
"net/http"
)

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@ryanc414
ryanc414 / git-rm-merged
Last active July 12, 2022 12:17
Delete merged git branches locally and on remote
#!/bin/bash
# Remove merged git branches locally and on remote(s)
set -e
# Script constants
BRANCH_WHITELIST="(\*|master|other-special-branches)"
REMOTES="origin" # Add more remotes here as space-separated list
echo "Deleting merged branches locally"