Copied over tester.py

I couldn’t figure out how to merge only one specific files, so I figure
I’d do it manually.
Removing Tabs

b/c I dislike tabs. They be stupid….. tabs. yuck.
Initial Thought on Script Process Flow

These are my initial thoughts on how the MAIN and class files should
operate and work together.
Also includes thoughts on what should be stored, in terms of test data
init Creation, main/speedTest/README Update

CREATIONS:
- __init__.py - holds list of all modules in module folder !!!TO BE
UPDATED WHEN MORE MODULES/CLASSES ARE MADE!!
- main.py - Added some documentation at the top
- speedTest.py - Was Tests.py. Added to new folder (iPerfClasses).
Added documentation at top, as well as check for whether script was run
as main or not
Adding comments, making sys.exit() work

- Added some comments to explain what I’m doing in name/main block
- forgot to import sys, and changed exit() to exit(0), which exits
script w/o error
So Updates! Many Fix! Much Happiness!

__init__.py
- removed provider from __all__

readTo.py
- created
- has readToAndGetLine function. This is so that the module can be
imported by all other classes, rather than just copied into each class

main.py
- added import line for importing speedTest module
- removed some old comments
- added some cheats to use when debugging
- - “-c” is used when the directory containing the data is known and set
- - “-cs” is used when 3 files have been specified. For even smaller
testing
- added comments before ask directory explaining the options (need to
add link to source info)
- simplified os.walk for loop

speedTest.py (soooooo many)
- added more function doc to top chunk
- removed readtoandgetline
- added import of readtoandgetline
- renamed Networktype attribute
- added LocationID attribute
- added isWBBD boolean attribute (to be used when determining which
parsing function to use)
- so many comments. All over the f***ing place
- init now determines if file is a WBBD, then calls load
- load() has simply doc at top
- initial print now looks a little nicer to me, and doesn’t display the
absolute path (just the bottom 3 levels)
- isItCPUC makes sure files has first line. If not, exits from script
- reading in time first checks if file is a WBBD
- more checks if file is WBBD
- many blocks check to see if attribute has nothing in it. If so,
changes value to “N/A”
- when adding line substring to variable, uses split[:-2]. the -2
ignores the \n and \r special characters at the end
- if file is WBBD, network type is automatically set to netbook (is
that correct?)
- when getting Network Provider for WBBD, get Location first, as it is
read over otherwise
- findSubTest has function doc above it
- __str__ has been slightly re-formatted
- Not in SubTest for when more work is done on it’s development
Moved classes to individual files

- Created the IndividualSpeedTest (was SubTest), SpeedPings (was
Pings), and Pings (was Ping)
- All new class files have default check for name=main, and empty
documentation at top
- Changed imports for all sub class (should now work on Windows)
- Changed class constructor call in main.py
Edited README

- added name of folder
- fixed grammar
Starting work on SpeedTestDataStruct

__init__.py
- commented out __all__ (don’t quite know how to use that yet)

main.py
- Removed all code creating SpeedTest objects
- Added creation of STDS (haha, STDs. We’re making STDs)

SpeedTestFile
- Added FileName attribute (also added to __str__ method)
- Changed Time atr. to DateTime (as the date is also included in the
data file)

SpeedTestDataStructure.py (STDs)
- atr. added (array of speed tests)
- - will later be broken up by type (mobile vs netbook) and by provider
- created function loadRawData
- - uses the system args passed in from command line (“-c” and “-cs”)
- - adds created SpeedTestFile objs to SpeedTests atr.
Small Fixes to imports

IndividSpeedTest
- needed .SpeedPings for relative reference (broke in python 3.4

STDs
- checking version of python before importing tkinter
- - before 3.0, tkinter was “Tkinter” and file dialog was “tkFileDialog”
- - after 3.0, tkinter was “tkinter” and file dialog was
“tkinter.filedialog”
Renaming / Error handling

IndividualSpeedTest
- changed sys.exit(0) to raise SystemExit
- changed .readTo module calls to .utils
- changed SpeedPings to PingThread

Pings
- sys.exit to SystemExit
- readTo to utils

Created PingThread

STDs
- sys.exit to SystemExit
- changed how check for system version works
- Checking for “CPUC Beta….” line in STDs (that way no object is
created if it’s not a CPUC data file)

SpeedTestFile
- sys.exit to SystemExit
- readTo to utils
- ADDED obj attar. FileStreamLoc (representing location in stream.
Integer represents which byte to jump to
- ADDED obj attar. Latitude and Longitude. Holds 0 by default.
- REMOVED isWBBD (no longer necessary)
- __init__ just reads file name and passes initialization to load()
- REMOVED “CPUC Beta…” test. Just read through that line and assign
stream location to FileStreamLoc (using .tell())
- Most header information now follows this structure:
—— seek to stored stream location
—— read until header line
—— if returned line is empty, attr. holds “N/A”
—— seek back to stored stream loc
- in the case of the date time, in non-WBBD files, the date is parsed
and translated into [mm/dd/yyyy hh:mm:ss]
- Some blocks have nested try/excepts. This is because in non-WBBD
files, there is a line “Location ID:”, but in WBBD, it is “Location:”
- Slightly modified __str__ output

utils
- checkVersion uses sys module. Compares to tuple that was passed in
[e.g (2,7) or (3,0)]
- monthAbbrToNum found on stackoverflow.com. In return, creates
dictionary and returns the value as the passed in index (must be
abbreviation)
- monthNumToAbbr works very similarly, only with numbers not
abbreviations
Almost working down to Individual Test Layer

There is a problem with the parsing. Python3.4 does something different
than Python2.7, and it’s cutting off a character. See testing~bash
diff.txt for diff between output1 and output2

utils
- added global_str_padding variable that will be used in all class
__str__ methods (for nice indentation between levels). At the beginning
of each class, pad is multiplied X times, based on what “level” the
class is at. (i.e. STDs = level 0, File=1, Individ=2, thread=3, ping=4)

main.py
- commented out section of code I used to do some testing of what was
in the iPerf command line (i.e., -i is always followed by 1)

IndividualSpeedTest
- large comment with copied text from testing~example_iPerf_commands.
Split up options that were in one test, and what were common options
- ClientIP -> RecieverIP
- added TestInterval
- __init__ calls load with data string passed in
- load()
—— save first line of data into string (Iperf command…..etc.)
—— determine attributes (TCP vs UDP, East vs West, etc.)
—— last if/else is where we will declare the ping threads
- __str__ prints out data

Pings
- kinda started __init__

PingThread
- __init__ by default adds empty Ping to this_Pings (should we do it
like this, for test files with no data?)

STDs
- added another command line option, -css (compact super short). uses
only one file

SpeedTestFile
- speedTests -> this_speedTests
- changed check for empty line (see line 274). Now just use temp[:-2]
to “remove” last two characters, and compare that to empty string
- removed findSpeedTest()
- added printSpeedTests()
- changed how __str__ works (added pad to pad out print lines)