Merge pull request #7 from RealOrangeOne/run-things-on-ci

More CI tests
This commit is contained in:
Jake Howard 2017-05-04 09:37:48 +01:00 committed by GitHub
commit b1fa4ad5a7
5 changed files with 13 additions and 5 deletions

View file

@ -4,6 +4,9 @@ machine:
node: node:
version: 6.10.2 version: 6.10.2
general:
artifacts:
- test-files/out/
dependencies: dependencies:
pre: pre:
@ -19,4 +22,5 @@ test:
- flake8 md_pdf/ --ignore=E128,E501 - flake8 md_pdf/ --ignore=E128,E501
- safety check - safety check
- bandit -r md_pdf/ - bandit -r md_pdf/
- mdp --help - mdp --update-csl
- cd test-files/ && mdp -vvv

View file

@ -1,6 +1,6 @@
import logging import logging
from md_pdf.args import parse_args from md_pdf.args import parse_args
from md_pdf.exceptions import PrematureExit, BaseException from md_pdf.exceptions import BaseException
from md_pdf.logging import set_verbosity from md_pdf.logging import set_verbosity
from md_pdf.build import build from md_pdf.build import build
from md_pdf.config.read import load_config from md_pdf.config.read import load_config
@ -19,8 +19,6 @@ def cli():
config = load_config() config = load_config()
validate_config(config) validate_config(config)
build(config) build(config)
except PrematureExit:
return 0
except BaseException as e: except BaseException as e:
logging.error(str(e)) logging.error(str(e))
return 1 return 1

View file

@ -24,7 +24,8 @@ def check_required_keys(config):
def test_output(config): def test_output(config):
abs_output_dir = os.path.abspath(config['output_dir']) abs_output_dir = os.path.abspath(config['output_dir'])
if not os.path.isdir(abs_output_dir): if not os.path.isdir(abs_output_dir):
raise ConfigValidationException("Can't find output directory '{}'".format(abs_output_dir)) logger.debug("Creating output directory...")
os.mkdir(abs_output_dir)
invalid_formats = [key for key in config['output_formats'] if key not in ['html', 'pdf']] invalid_formats = [key for key in config['output_formats'] if key not in ['html', 'pdf']]
if invalid_formats: if invalid_formats:
raise ConfigValidationException("Invalid output formats provided: '{}'".format(", ".join(invalid_formats))) raise ConfigValidationException("Invalid output formats provided: '{}'".format(", ".join(invalid_formats)))

View file

@ -26,6 +26,8 @@ def download_csl():
remove_dir(CSL_DIR) remove_dir(CSL_DIR)
def download_handle(count, block_size, total_size): def download_handle(count, block_size, total_size):
if total_size < 1: # only update the bar if we have a size
return
bar.update(int(count * block_size * 100 / total_size)) bar.update(int(count * block_size * 100 / total_size))
_, download_location = tempfile.mkstemp() _, download_location = tempfile.mkstemp()

View file

@ -4,6 +4,7 @@ from setuptools import setup, find_packages
setup( setup(
name="md-pdf", name="md-pdf",
version="1.0", version="1.0",
use_scm_version=True,
install_requires=[ install_requires=[
"beautifulsoup4==4.5.3", "beautifulsoup4==4.5.3",
"jinja2==2.9.5", "jinja2==2.9.5",
@ -13,8 +14,10 @@ setup(
"pyscss==1.3.5", "pyscss==1.3.5",
"PyYAML==3.12" "PyYAML==3.12"
], ],
setup_requires=['setuptools_scm'],
packages=find_packages(), packages=find_packages(),
include_package_data=True, include_package_data=True,
zip_safe=False,
entry_points=""" entry_points="""
[console_scripts] [console_scripts]
mdp=md_pdf.cli:cli mdp=md_pdf.cli:cli