Skip to content

Commit 75c2437

Browse files
committed
Update files from template
1 parent d418fb6 commit 75c2437

File tree

10 files changed

+55
-23
lines changed

10 files changed

+55
-23
lines changed

.gitignore

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1-
*.ipynb_checkpoints
21
*.mo
3-
*.pyc
42
*.swp
53
.cache
6-
.ropeproject
74
.ve
8-
venv
95

106
/build
117
/cache.sqlite
128
/chromedriver
139
/chromedriver_linux64.zip
1410
/chromedriver_mac64.zip
1511
/chromedriver_win32.zip
12+
/docs/_static/patched

.travis.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ install:
2727
- pip install -r requirements.txt
2828
script:
2929
- curl -s -S --retry 3 $BASEDIR/tests/script.sh | bash -
30+
- if [ $TRAVIS_REPO_SLUG = 'open-contracting/standard_profile_template' ]; then python schema/build-profile.py; make extract; fi
3031
- make
31-
- py.test -rs --tb=line
32+
- py.test

Makefile

-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
# Update this file from a profile with:
2-
# curl -O https://raw.githubusercontent.com/open-contracting/standard_profile_template/master/Makefile
3-
41
include include/prologue.mk include/config.mk include/common.mk

include/common.mk

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Update this file from a profile with:
2-
# curl https://raw.githubusercontent.com/open-contracting/standard_profile_template/master/include/common.mk -o include/common.mk
3-
41
# See https://github.com/datamade/data-making-guidelines
52

63
# See http://clarkgrubb.com/makefile-style-guide#phony-target-arg

include/config.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LOCALE_DIR=standard/docs/locale
1515
# Directory in which to build documentation files.
1616
BUILD_DIR=build
1717
# Extra build files or directories. (These should match paths in .gitignore.)
18-
EXTRA_BUILD_FILES=/chromedriver*
18+
EXTRA_BUILD_FILES=chromedriver*
1919
# Files that are built and distributed (you may use Bash extended globbing).
2020
DIST_FILES=
2121
# Directory in which to build .pot files.

include/prologue.mk

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# Update this file from a profile with:
2-
# curl https://raw.githubusercontent.com/open-contracting/standard_profile_template/master/include/prologue.mk -o include/prologue.mk
3-
41
# See http://clarkgrubb.com/makefile-style-guide#prologue
52
MAKEFLAGS += --warn-undefined-variables
63
SHELL := bash

script/diff

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
for f in .travis.yml docs/conf.py include/config.mk schema/build-profile.py; do
3+
curl -sS https://raw.githubusercontent.com/open-contracting/standard_profile_template/master/$f | diff -u - $f
4+
done
5+
6+
if [ -d standard -o -d schema/project-level ]; then
7+
curl -sS https://raw.githubusercontent.com/open-contracting/standard_profile_template/master/.gitignore | diff -u - .gitignore
8+
fi

script/update

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ -f standard ]; then
5+
prefix=standard/
6+
else
7+
prefix=
8+
fi
9+
10+
mkdir -p script include ${prefix}tests
11+
12+
for f in Makefile common-requirements.txt include/common.mk include/prologue.mk script/diff script/update; do
13+
curl -sS -o $f https://raw.githubusercontent.com/open-contracting/standard_profile_template/master/$f
14+
done
15+
16+
for f in tests/conftest.py tests/test_common.py; do
17+
curl -sS -o $prefix$f https://raw.githubusercontent.com/open-contracting/standard_profile_template/master/$f
18+
done
19+
20+
if [ ! -d standard -a ! -d schema/project-level ]; then
21+
curl -sS -o .gitignore https://raw.githubusercontent.com/open-contracting/standard_profile_template/master/.gitignore
22+
fi
23+
24+
chmod +x script/*

standard/tests/conftest.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Update this file from a profile with:
2-
# curl https://raw.githubusercontent.com/open-contracting/standard_profile_template/master/tests/conftest.py -o tests/conftest.py # noqa
31
import os
42
from http.server import HTTPServer, SimpleHTTPRequestHandler
53
from multiprocessing import Process

standard/tests/test_common.py

+19-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1-
# Update this file from a profile with:
2-
# curl https://raw.githubusercontent.com/open-contracting/standard_profile_template/master/tests/test_common.py -o tests/test_common.py # noqa
1+
import os
32
import re
43
import time
4+
import warnings
55

66
import pytest
77
import requests
88
from selenium.common.exceptions import NoSuchElementException
99
from selenium.webdriver.support.ui import Select
1010

11-
from . import languages, test_basic_params, test_search_params
11+
from tests import languages, test_basic_params, test_search_params
12+
13+
cwd = os.getcwd()
14+
15+
16+
def custom_warning_formatter(message, category, filename, lineno, line=None):
17+
return str(message).replace(cwd + os.sep, '')
18+
19+
20+
warnings.formatwarning = custom_warning_formatter
1221

1322

1423
@pytest.mark.parametrize('lang,text', test_basic_params.items())
@@ -44,6 +53,7 @@ def test_broken_links(browser, server, lang):
4453
referrer = ''
4554
hrefs = set()
4655
browser.get('{}{}'.format(server, lang))
56+
failures = []
4757
while True:
4858
for link in browser.find_elements_by_partial_link_text(''):
4959
href = re.sub(r'#.*$', '', link.get_attribute('href'))
@@ -58,9 +68,8 @@ def test_broken_links(browser, server, lang):
5868
hrefs.add(href)
5969

6070
response = requests.get(href)
61-
assert response.status_code == 200, 'expected 200, got {} for {} linked from {}'.format(
62-
response.status_code, href, referrer)
63-
71+
if response.status_code != 200:
72+
failures.append([response.status_code, href, referrer])
6473
try:
6574
# Scroll the link into view, to make it clickable.
6675
link = browser.find_element_by_link_text('Next')
@@ -69,3 +78,7 @@ def test_broken_links(browser, server, lang):
6978
link.click()
7079
except NoSuchElementException:
7180
break
81+
82+
for status_code, href, referrer in failures:
83+
warnings.warn('expected 200, got {} for {} linked from {}\n'.format(status_code, href, referrer))
84+
assert not failures, 'One or more links are broken. See warnings below.'

0 commit comments

Comments
 (0)