Fix tests for file_transfer and perceptron.py (#1121)

This commit is contained in:
Christian Clauss 2019-08-11 13:00:58 +02:00 committed by GitHub
parent 36684db278
commit 55cea57ffa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 67 deletions

View File

@ -4,32 +4,6 @@ python: 3.7
cache: pip cache: pip
before_install: pip install --upgrade pip setuptools before_install: pip install --upgrade pip setuptools
install: pip install -r requirements.txt install: pip install -r requirements.txt
matrix:
include:
- name: "Main tests"
# The following files currently fail pytests. See issues: #1016, #1044, #1080
# Here they are run allow_failures mode and when each passes pytest, it can be
# removed BOTH lists below. Complex now but simple once all files pass pytest.
# - env: FILE=pytest file_transfer_protocol/ftp_client_server.py
# before_script: true
# script: pytest ${FILE} --doctest-modules
- env: FILE=pytest file_transfer/ftp_send_receive.py
before_script: true
script: pytest ${FILE} --doctest-modules
- env: FILE=pytest machine_learning/linear_regression.py
before_script: true
script: pytest ${FILE} --doctest-modules
- env: FILE=pytest machine_learning/perceptron.py
before_script: true
script: pytest ${FILE} --doctest-modules
- env: FILE=pytest machine_learning/random_forest_classification/random_forest_classification.py
before_script: true
script: pytest ${FILE} --doctest-modules
- env: FILE=pytest machine_learning/random_forest_regression/random_forest_regression.py
before_script: true
script: pytest ${FILE} --doctest-modules
allow_failures:
- before_script: true
before_script: before_script:
- black --check . || true - black --check . || true
- flake8 . --count --select=E9,F401,F63,F7,F82 --show-source --statistics - flake8 . --count --select=E9,F401,F63,F7,F82 --show-source --statistics
@ -37,11 +11,6 @@ script:
- scripts/validate_filenames.py # no uppercase, no spaces, in a directory - scripts/validate_filenames.py # no uppercase, no spaces, in a directory
- mypy --ignore-missing-imports . - mypy --ignore-missing-imports .
- pytest . --doctest-modules - pytest . --doctest-modules
--ignore=file_transfer/ftp_send_receive.py
--ignore=machine_learning/linear_regression.py
--ignore=machine_learning/perceptron.py
--ignore=machine_learning/random_forest_classification/random_forest_classification.py
--ignore=machine_learning/random_forest_regression/random_forest_regression.py
after_success: after_success:
- scripts/build_directory_md.py > DIRECTORY.md - scripts/build_directory_md.py > DIRECTORY.md
- cat DIRECTORY.md - cat DIRECTORY.md

View File

@ -1,36 +0,0 @@
"""
File transfer protocol used to send and receive files using FTP server.
Use credentials to provide access to the FTP client
Note: Do not use root username & password for security reasons
Create a seperate user and provide access to a home directory of the user
Use login id and password of the user created
cwd here stands for current working directory
"""
from ftplib import FTP
ftp = FTP('xxx.xxx.x.x') # Enter the ip address or the domain name here
ftp.login(user='username', passwd='password')
ftp.cwd('/Enter the directory here/')
"""
The file which will be received via the FTP server
Enter the location of the file where the file is received
"""
def ReceiveFile():
FileName = 'example.txt' """ Enter the location of the file """
with open(FileName, 'wb') as LocalFile:
ftp.retrbinary('RETR ' + FileName, LocalFile.write, 1024)
ftp.quit()
"""
The file which will be sent via the FTP server
The file send will be send to the current working directory
"""
def SendFile():
FileName = 'example.txt' """ Enter the name of the file """
with open(FileName, 'rb') as LocalFile:
ftp.storbinary('STOR ' + FileName, LocalFile)
ftp.quit()