Skip to content

Commit

Permalink
Run pytest-cov with append flag in tox, clean code
Browse files Browse the repository at this point in the history
Modify setup.cfg

Try to make scrutinizer.io recognize the coverage data

Make travis send coverage data on unittests build jobs

WIP

Comment out coveralls from tox pipeline
  • Loading branch information
Konstantinos committed Jul 17, 2019
1 parent ccd84da commit 6805f8f
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 201 deletions.
3 changes: 2 additions & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ build:
tests:
before:
- pip install coverage
after:
override:
- tox
-
command: coverage combine
coverage:
Expand Down
105 changes: 11 additions & 94 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,58 +1,42 @@
os: linux
language: python

env:
global:
- LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so
- SEGFAULT_SIGNALS=all

#matrix:
# include:
# - python: '3.6'
# env:
# - TOXENV=check
# - env:
# - TOXENV=py35
# python: '3.5'
# - env:
# - TOXENV=py36
# python: '3.6'
# - env:
# - TOXENV=py37
# python: '3.7'

- TOX_SKIP_MISSING_INTERPRETERS="False"

before_install:
- python --version
# - pip install coveralls
- uname -a
- lsb_release -a
- chmod +x .travis/install-tox.sh
- chmod +x .travis/run-tox.sh
- sudo apt-get install ffmpeg
# - chmod +x .travis/deploy.sh


install:
- .travis/install-tox.sh
# - pip install tox-travis
- pip install tox
- pip install coveralls
- virtualenv --version
- easy_install --version
- pip --version
- tox --version
- pip install coveralls

cache: pip
script: .travis/run-tox.sh
script:
- tox
- coveralls

jobs:
fail_fast: true
include:
- stage: Check
env: TOXENV=clean
script: tox
- stage: run tests
python: '3.6'
env: TOXENV=quality
script:
- export TOX_SKIP_MISSING_INTERPRETERS="False"
- tox
script: tox
- stage: run tests
python: '3.5'
env: TOXENV=py35
Expand All @@ -62,80 +46,13 @@ jobs:
- stage: run tests
python: '3.7'
env: TOXENV=py37
# - stage: send coverage data to coveralls.io
# python: '3.6'
# env: TOXENV=reporting
allow_failures:
- env: TOXENV=quality

after_failure:
- more .tox/log/* | cat
- more .tox/*/log/* | cat

# - stage: run tests and linters
# language: node_js
# node_js: 6
# cache: yarn
# env: COMPONENT=server CMD=lint
# before_install: cd server
# script: bash ../scripts/travis-yarn.sh
#
#quality: &quality
# - stage: "Quality"
# name: "Quallity assertion"
# script: .travis/run-tox.sh
#
#tests: &tests
# - stage: "Tests"
# name: "Unit Tests"
# script: .travis/run-tox.sh


# - name: "Helper Tests"
# script: time ./run yarn test:named Helper
# - name: "Integration Tests"
# script: time ./run yarn test:named Integration
# - name: "Acceptance Tests"
# script: time ./run yarn test:named Acceptance
# - name: "a11y"
# script: PERCY_ENABLE=0 time ./run yarn test:named Acceptance --query enableA11yAudit=true

#quality: &quality
# - stage: "Quality"
# name: "Lint JS/TS"
# script: time ./run yarn lint:js
# - name: "Lint Templates"
# script: time ./run yarn lint:hbs
# - name: "Lint Styles"
# script: time ./run yarn lint:sass
# - name: "Check Types"
# script: time ./run yarn tsc
# - name: "Translations"
# script: time ./run yarn lint:i18n

#jobs:
# fail_fast: true
#
# include:
# - <<: *quality
# env:
# - TOXENV=quality

# - <<: *tests
# env:
# - TOXENV=py35
##
# - <<: *tests
# python: 3.6
# env:
# - TOXENV=py36
#
# - <<: *tests
# python: 3.7
# env:
# - TOXENV=py37

#script: ./.travis/run-tox.sh
#
#deploy:
# provider: script
Expand Down
3 changes: 0 additions & 3 deletions .travis/deploy.sh

This file was deleted.

6 changes: 0 additions & 6 deletions .travis/install-tox.sh

This file was deleted.

10 changes: 0 additions & 10 deletions .travis/run-tox.sh

This file was deleted.

45 changes: 19 additions & 26 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,30 @@
description-file = README.rst
license_file = LICENSE.txt


[flake8]
max-line-length = 140
exclude = */migrations/*

[tool:pytest]
testpaths = tests
norecursedirs =
migrations

python_files =
test_*.py
*_test.py
tests.py
addopts =
-ra
--strict
--doctest-modules
--doctest-glob=\*.rst

python_versions =
py35
py36
py37
norecursedirs =
migrations
python_files =
test_*.py
*_test.py
tests.py
addopts =
-ra
--strict
--doctest-modules
--doctest-glob=\*.rst
python_versions =
py35
py36
py37
dependencies =
environment_variables =
-

dependencies =
# 1.4: Django==1.4.16 !python_versions[py3*]
# 1.5: Django==1.5.11
# 1.6: Django==1.6.8
# 1.7: Django==1.7.1 !python_versions[py26]
# Deps commented above are provided as examples. That's what you would use in a Django project.
[easy_install]

environment_variables =
-
60 changes: 43 additions & 17 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,52 +1,78 @@
import os
from glob import glob
from os.path import basename
from os.path import splitext
from setuptools import setup, find_packages


my_dir = os.path.dirname(os.path.realpath(__file__))


def readme():
with open(os.path.join(my_dir, 'README.rst')) as f:
return f.read()
# return str(resource_string(__name__, 'README.rst'))


setup(
name='music_album_creation',
version='1.0.8a',
description='A CLI application intending to automate offline music library building',
version='1.1.0',
description='A CLI application intending to automate offline music library building.',
long_description=readme(),
keywords=['music album', 'automation', 'youtube', 'audio metadata', 'download'],
keywords='music automation download youtube metadata',

project_urls={
"Source Code": "https://github.com/boromir674/music-album-creator",
},
zip_safe=False,

# what packages/distributions (python) need to be installed when this one is. (Roughly what is imported in source code)
install_requires=['tqdm', 'click', 'sklearn', 'mutagen', 'PyInquirer', 'youtube_dl'],

# A string or list of strings specifying what other distributions need to be present in order for the setup script to run.
# (Note: projects listed in setup_requires will NOT be automatically installed on the system where the setup script is being run.
# They are simply downloaded to the ./.eggs directory if they’re not locally available already. If you want them to be installed,
# as well as being available when the setup script is run, you should add them to install_requires and setup_requires.)
# setup_requires=[],

# Folder where unittest.TestCase-like written modules reside. Specifying this argument enables use of the test command
# to run the specified test suite, e.g. via setup.py test.
test_suite='tests',

# Declare packages that the project’s tests need besides those needed to install it. A string or list of strings specifying
# what other distributions need to be present for the package’s tests to run. Note that these required projects will not be installed on the system where the
# tests are run, but only downloaded to the project’s setup directory if they’re not already installed locally.
# Use to ensure that a package is available when the test command is run.
tests_require=['pytest'],

classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Multimedia :: Sound/Audio :: Conversion',
'Topic :: Multimedia :: Sound/Audio :: Editors',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Science/Research'
],
url='https://github.com/boromir674/music-album-creator',
download_url='point to tar.gz', # help easy_install do its tricks
author='Konstantinos Lampridis',
author_email='[email protected]',
license='GNU GPLv3',
packages=find_packages(where='src'),
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
install_requires=['tqdm', 'click', 'sklearn', 'mutagen', 'PyInquirer', 'youtube_dl'],
include_package_data=True,
package_dir={'': 'src'}, # this is required by distutils
# py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')],
include_package_data=True, # Include all data files in packages that distutils are aware of through the MANIFEST.in file
# package_data={
# # If any package contains *.txt or *.rst files, include them:
# '': ['*.txt', '*.rst'],
# 'music_album_creation.format_classification': ['data/*.txt', 'data/model.pickle'],
# },
entry_points={
'console_scripts': [
'create-album = music_album_creation.create_album:main',
]
},
# TODO check if/where to put pytest
# setup_requires=['numpy>=1.11.0'],
tests_require=['tox', 'pytest'],
# test_suite='',
zip_safe=False
# A dictionary mapping names of “extras” (optional features of your project: eg imports that a console_script uses) to strings or lists of strings
# specifying what other distributions must be installed to support those features.
# extras_require={},
)
16 changes: 8 additions & 8 deletions src/music_album_creation/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ def multiline_input(prompt_=None):
##### STORE ALBUM DIALOG
def store_album_dialog(tracks, music_lib='', artist='', album='', year=''):

def _copy_tracks(track_files, destination_directory):
def _copy_tracks(track_files, destination_dir):
for track in track_files:
destination_file_path = os.path.join(destination_directory, os.path.basename(track))
destination_file_path = os.path.join(destination_dir, os.path.basename(track))
if os.path.isfile(destination_file_path):
print(" File '{}' already exists. in '{}'. Skipping".format(os.path.basename(track),
destination_directory))
destination_dir))
else:
shutil.copyfile(track, destination_file_path)
print("Album tracks reside in '{}'".format(destination_directory))
print("Album tracks reside in '{}'".format(destination_dir))

if year:
album = '{} ({})'.format(album, year)
Expand Down Expand Up @@ -141,7 +141,7 @@ def validate(self, document):
message='Please enter a number',
cursor_position=len(document.text)) # Move cursor to end

def set_metadata_panel(artist=artist, album=album, year=year):
def set_metadata_panel(default_artist=artist, default_album=album, default_year=year):
questions = [
{
'type': 'confirm',
Expand All @@ -168,7 +168,7 @@ def set_metadata_panel(artist=artist, album=album, year=year):
{
'type': 'input',
'name': 'artist',
'default': artist,
'default': default_artist,
'message': "'artist' tag",
},
{
Expand All @@ -180,14 +180,14 @@ def set_metadata_panel(artist=artist, album=album, year=year):
{
'type': 'input',
'name': 'album',
'default': album,
'default': default_album,
'message': "'album' tag",
},
{
'type': 'input',
'name': 'year',
'message': "'year' tag",
'default': year, # trick to allow empty value
'default': default_year, # trick to allow empty value
'validate': NumberValidator,
# 'filter': lambda val: int(val)
},
Expand Down
Loading

0 comments on commit 6805f8f

Please sign in to comment.