Skip to content

Instantly share code, notes, and snippets.

@jaraco
jaraco / test_fo.py
Last active August 29, 2015 14:16
FixedOffset serialization fails
"""
Save this file as test_fo.py and run it
"""
import pprint
import json
import datetime
import pickle
jsonpickle = None
@jaraco
jaraco / test-mongodb-records.py
Created February 13, 2016 19:05
Demonstration of pytest-runner to invoke a script with dependencies loaded.
"""
This script demonstrates how pytest-runner facilitates
the simple execution of complex tasks with their
dependencies.
Save this file and invoke it
under Python (i.e. ``python test-mongodb-records.py``).
It creates a MongoDB instance, and then runs some
assertions against it.
@jaraco
jaraco / test_isuse32.py
Last active July 26, 2016 20:15
Test attempting to replicate /whit537/mongs/issues/32
__requires__ = ['jaraco.mongodb', 'pymongo==3.2.2', 'pytest']
import pytest
import sys
import bson
def test_issue(mongodb_instance):
coll = mongodb_instance.get_connection()['test_db']['test_coll']
explicit_id = bson.ObjectId()
# insert id as string
@jaraco
jaraco / gist:6be7e8fb4d9f8e21b0883e6f56db2985
Created October 21, 2016 15:17
pytest test failures on macOS, Python 3.5
$ python -m tox -e py35 -- -rs
GLOB sdist-make: /Users/jaraco/Dropbox/code/public/pytest/setup.py
py35 recreate: /Users/jaraco/Dropbox/code/public/pytest/.tox/py35
py35 installdeps: hypothesis>=3.5.2, nose, mock, requests
py35 inst: /Users/jaraco/Dropbox/code/public/pytest/.tox/dist/pytest-3.0.4.dev0.zip
py35 installed: hypothesis==3.5.3,mock==2.0.0,nose==1.3.7,pbr==1.10.0,py==1.4.31,pytest==3.0.4.dev0,requests==2.11.1,six==1.10.0,spark-parser==1.4.0,uncompyle6==2.9.2,xdis==3.1.0
py35 runtests: PYTHONHASHSEED='2429941045'
py35 runtests: commands[0] | pytest --lsof -rfsxX -rs
=========================================== test session starts ===========================================
platform darwin -- Python 3.5.2, pytest-3.0.4.dev, py-1.4.31, pluggy-0.4.0
$ stackato stacks
SSL warning for "api.stackato-r6sc.local": self signed certificate
Stacks: https://api.stackato-r6sc.local
+---------------+----------------------+
| Name | Description |
+---------------+----------------------+
| alsek | Stackato Alsek Stack |
| cflinuxfs2 | CF Linux FS2 Stack |
| trusty | YouGov Trusty |
stackato@stackato-r6sc:~$ kato config push -j dea_ng stacks '{"name": "yougov/trusty", "package_path": "not used"}'
[
{
"name": "alsek",
"package_path": "/var/warden/rootfs_alsek"
},
{
"name": "lucid64",
"package_path": "/var/warden/rootfs_lucid"
},
stackato@stackato-r6sc:~$ cat /s/code/cloud_controller_ng/config/stacks.yml
# lucid64 stack is just a default stack that was made
# in the create_stacks_table migration
default: "alsek"
stacks:
- name: "alsek"
description: "Stackato Alsek Stack"
- name: "cflinuxfs2"
stackato@stackato-r6sc:~$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
yougov/trusty latest 4edc1a2fcc0f 9 hours ago 1.133 GB
stackato/stack-cflinuxfs2 latest ce1aa327df85 22 hours ago 1.092 GB
stackato/docker-registry fix-token-auth f8937847145b 45 hours ago 425.4 MB
...
Today I had a poor experience with Plenti. I've used Plenti with just a few vendors (Macy's, Exxon), but today I walked into a RiteAid and realized I could use my Plenti card there. I knew I could give my phone number for my account, but I wanted to check to see if there was an App that would add a card to my Apple Wallet in case my phone number didn't work. So I downloaded the Plenti app for iOS and tried to sign in. I tried three different passwords that I might have used, but none were correct, so I was locked out of my account. I tried calling the Plenti Customer Support, but it prompted me for my Plenti account number, which I did not have memorized, so I figured I would deal with that later.
I shopped around, picking out a few items based on the member pricing and went to check out. When I did, I entered my Plenti number, but it wasn't accepted. I tried again two more times, but my phone number was not accepted. So I was forced to check out paying full price for items I expected to receive at a discoun
jaraco@host:~$ cat > test.py
uni = u"\u001A\u0BC3\u1451\U0001D10C"
print uni
jaraco@host:~$ python2.7 ./test.py > out.txt
Traceback (most recent call last):
File "./test.py", line 2, in <module>
print uni
UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-3: ordinal not in range(128)