Skip to content

Commit

Permalink
Merge pull request #1 from scopeta/master
Browse files Browse the repository at this point in the history
Updating fork
  • Loading branch information
Arthurcn96 authored Oct 7, 2020
2 parents aa3c6bf + e020ab2 commit ec60bf5
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
3 changes: 3 additions & 0 deletions config/fm.init
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ short_break = 5
long_break = 25
num_rounds = 3

[sound]
sound = True

11 changes: 11 additions & 0 deletions focusedme/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,13 @@ def load_init():
for section in list(config['time']):
len_args[section] = int(config['time'][section])

for section in list(config['sound']):
sound_enabled = str(config['sound'][section])

if sound_enabled:
SOUND = bool(sound_enabled)
len_args[section] = SOUND

return len_args

def save_init(len_args):
Expand All @@ -423,6 +430,9 @@ def save_init(len_args):
for section in list(config['time']):
config.set('time',section, str(len_args[section]))

for section in list(config['sound']):
config.set('sound',section, str(len_args[section]))

with open(file, 'w') as configfile:
config.write(configfile)

Expand All @@ -439,6 +449,7 @@ def show_init(len_args):
print(View.getColor("orange") + " Short Break: " + str(len_args["short_break"]))
print(View.getColor("red") + " Long Break: " + str(len_args["long_break"]))
print(View.getColor("blue") + " Rounds: " + str(len_args["num_rounds"]))
print(View.getColor("purple") + " Sound: " + str(len_args["sound"]))
print( View.getColor("reset") )

def main():
Expand Down
27 changes: 14 additions & 13 deletions tests/test_focusedme.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
"""Tests for `focusedme` package."""

import pytest


import focusedme

from focusedme import util

@pytest.fixture
def response():
"""Sample pytest fixture.
def call_in_app_path():
return util.in_app_path('test.txt')

See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
def test_in_app_path(call_in_app_path):
import pathlib

assert call_in_app_path == str(pathlib.Path().absolute()) + '/focusedme/test.txt'

@pytest.fixture
def call_from_resource():
return util._from_resource('test.txt')

def test_from_resource(call_from_resource):
import pathlib

def test_content(response):
"""Sample pytest test function with the pytest fixture as an argument."""
# from bs4 import BeautifulSoup
# assert 'GitHub' in BeautifulSoup(response.content).title.string
assert call_from_resource == str(pathlib.Path().absolute()) + '/focusedme/test.txt'

0 comments on commit ec60bf5

Please sign in to comment.